]> www.infradead.org Git - users/dwmw2/linux.git/commit
libertas_tf: avoid a null dereference in pointer priv
authorColin Ian King <colin.king@canonical.com>
Fri, 1 May 2020 17:39:00 +0000 (18:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:32:39 +0000 (09:32 +0200)
commitb2fb5416e528c8b20ae92f53448e63aeeb7c712c
tree2b26b47c2b5c1e83b60f51784296d61e2ac2710d
parent655283c14389ee904d3dfb059155ca50913ebeee
libertas_tf: avoid a null dereference in pointer priv

[ Upstream commit 049ceac308b0d57c4f06b9fb957cdf95d315cf0b ]

Currently there is a check if priv is null when calling lbtf_remove_card
but not in a previous call to if_usb_reset_dev that can also dereference
priv.  Fix this by also only calling lbtf_remove_card if priv is null.

It is noteable that there don't seem to be any bugs reported that the
null pointer dereference has ever occurred, so I'm not sure if the null
check is required, but since we're doing a null check anyway it should
be done for both function calls.

Addresses-Coverity: ("Dereference before null check")
Fixes: baa0280f08c7 ("libertas_tf: don't defer firmware loading until start()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200501173900.296658-1-colin.king@canonical.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/marvell/libertas_tf/if_usb.c