Re: [PATCH] net: iwlegacy: fix potential NULL pointer dereferences
From: Stanislaw Gruszka
Date: Mon Mar 11 2019 - 05:16:11 EST
On Mon, Mar 11, 2019 at 02:37:57AM -0500, Kangjie Lu wrote:
> In case create_singlethread_workqueue fails, the fix immediately
> return to avoid NULL pointer dereferences.
>
> Signed-off-by: Kangjie Lu <kjlu@xxxxxxx>
> ---
> drivers/net/wireless/intel/iwlegacy/3945-mac.c | 2 ++
> drivers/net/wireless/intel/iwlegacy/4965-mac.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> index 271977f7fbb0..d23ee2ca0c8e 100644
> --- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> +++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> @@ -3403,6 +3403,8 @@ static void
> il3945_setup_deferred_work(struct il_priv *il)
> {
> il->workqueue = create_singlethread_workqueue(DRV_NAME);
> + if (!il->workqueue)
> + return;
This is not full fix since we will crash later without setup various
structures in il3945_setup_deferred_work. The driver is pretty
much legacy and worked for decade (or maybe more) without NULL
dereference of il->workqueue. I do not see need to fix _potential_
problems as fix can introduce more harm than good.
Stanislaw