]> git.baikalelectronics.ru Git - kernel.git/commit
staging: wilc1000: fix null checks on wilc
authorColin Ian King <colin.king@canonical.com>
Tue, 11 Sep 2018 17:38:51 +0000 (18:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Sep 2018 08:45:51 +0000 (10:45 +0200)
commit0b3896724c4bf9cd9788d936c61d0bda825712fe
treef9de7f522b03cd4755b1bfb35e8309b3f21956ce
parent55063ff4624ff89081b7b40a459c397eba428100
staging: wilc1000: fix null checks on wilc

Currently the pointer wilc is being null checked several times
and yet not checked for the final workqueue flush and destroy
(which can lead to a null pointer dereference if wilc is null);
these missing null checks were overlooked in an earlier core
refactoring commit.

Clean up the code by checking wilc at the start and bailing out
early if it is null allowing the subsequent null checks to be
removed, this also fixes the potential null pointer deferences
on the workqueue flush and destroy calls.

Detected by CoverityScan, CID#1473305 ("Dereference after null check")

Fixes: 11b0aa847921 ("staging: wilc1000: refactor code to move initilization in wilc_netdev_init()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c