[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y3yve5ld6KSj4GyU@unreal>
Date: Tue, 22 Nov 2022 13:16:11 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Denis Arefev <arefev@...mel.ru>
Cc: Simon Horman <simon.horman@...ronome.com>,
Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>, oss-drivers@...ronome.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org, trufanov@...mel.ru, vfh@...mel.ru
Subject: Re: [PATCH net v3] nfp: flower: Added pointer check and continue
On Fri, Nov 18, 2022 at 11:03:17AM +0300, Denis Arefev wrote:
> Return value of a function 'kmalloc_array' is dereferenced at
> lag_conf.c:347 without checking for null,
> but it is usually checked for this function.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> Fixes: bb9a8d031140 ("nfp: flower: monitor and offload LAG groups")
> Signed-off-by: Denis Arefev <arefev@...mel.ru>
> ---
> drivers/net/ethernet/netronome/nfp/flower/lag_conf.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
<...>
> acti_netdevs = kmalloc_array(entry->slave_cnt,
> sizeof(*acti_netdevs), GFP_KERNEL);
> + if (!acti_netdevs) {
> + schedule_delayed_work(&lag->work, NFP_FL_LAG_DELAY);
> + continue;
It is usually not good idea to continue after memory allocation fails.
So or add __GFP_NOWARN with a comment why it is safe to continue or bail
out from this loop.
Thanks
> + }
>
> /* Include sanity check in the loop. It may be that a bond has
> * changed between processing the last notification and the
> --
> 2.25.1
>
Powered by blists - more mailing lists