[Intel-wired-lan] [PATCH] net: fm10k: fix a potential NULL pointer dereference

Mukesh Ojha mojha at codeaurora.org
Sat Mar 23 10:08:59 UTC 2019


On 3/11/2019 11:47 AM, Kangjie Lu wrote:
> In case alloc_workqueue fails, the fix returns -ENOMEM to avoid
> potential NULL pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu at umn.edu>
> ---
>   drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
> index 5a0419421511..215f232674f1 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
> @@ -41,6 +41,8 @@ static int __init fm10k_init_module(void)
>   	/* create driver workqueue */
>   	fm10k_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0,
>   					  fm10k_driver_name);
> +	if (unlikely(!fm10k_workqueue))
> +		return -ENOMEM;
>   
>   	fm10k_dbg_init();
>   


Reviewed-by: Mukesh Ojha <mojha at codeaurora.org 
<mailto:mojha at codeaurora.org>>

Thanks.
Mukesh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20190323/fbcf97ef/attachment.html>


More information about the Intel-wired-lan mailing list