From: Louis Peens <louis.peens@corigine.com>
To: Duoming Zhou <duoming@zju.edu.cn>
Cc: linux-kernel@vger.kernel.org, yinjun.zhang@corigine.com,
netdev@vger.kernel.org, oss-drivers@corigine.com,
christophe.jaillet@wanadoo.fr, horms@kernel.org,
pabeni@redhat.com, edumazet@google.com, davem@davemloft.net,
kuba@kernel.org, arefev@swemel.ru
Subject: Re: [PATCH v2] nfp: flower: handle acti_netdevs allocation failure
Date: Fri, 8 Mar 2024 17:06:00 +0200 [thread overview]
Message-ID: <ZespWEukbuJZcdI8@LouisNoVo> (raw)
In-Reply-To: <20240308142540.9674-1-duoming@zju.edu.cn>
On Fri, Mar 08, 2024 at 10:25:40PM +0800, Duoming Zhou wrote:
> [Some people who received this message don't often get email from duoming@zju.edu.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> The kmalloc_array() in nfp_fl_lag_do_work() will return null, if
> the physical memory has run out. As a result, if we dereference
> the acti_netdevs, the null pointer dereference bugs will happen.
>
> This patch adds a check to judge whether allocation failure occurs.
> If it happens, the delayed work will be rescheduled and try again.
>
> Fixes: bb9a8d031140 ("nfp: flower: monitor and offload LAG groups")
> Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
> ---
> Changes in v2:
> - Remove print warnings on allocation failures.
Thanks Duoming. Just a reminder for next time, it is recommended to add
the tree name to the patch summary ([PATCH net] or [PATCH net-next])
when submitting to netdev. Since this contains a "Fixes" tag it should
probably have been aimed at 'net'.
Reviewed-by: Louis Peens <louis.peens@corigine.com>
>
> drivers/net/ethernet/netronome/nfp/flower/lag_conf.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c
> index 361d7c495e2..2c7bd6e80d9 100644
> --- a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c
> +++ b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c
> @@ -337,6 +337,11 @@ static void nfp_fl_lag_do_work(struct work_struct *work)
>
> 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;
> + }
>
> /* Include sanity check in the loop. It may be that a bond has
> * changed between processing the last notification and the
> --
> 2.17.1
>
next prev parent reply other threads:[~2024-03-08 15:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 14:25 [PATCH v2] nfp: flower: handle acti_netdevs allocation failure Duoming Zhou
2024-03-08 15:06 ` Louis Peens [this message]
2024-03-11 23:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZespWEukbuJZcdI8@LouisNoVo \
--to=louis.peens@corigine.com \
--cc=arefev@swemel.ru \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=duoming@zju.edu.cn \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@corigine.com \
--cc=pabeni@redhat.com \
--cc=yinjun.zhang@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).