summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuoming Zhou <duoming@zju.edu.cn>2024-03-08 22:25:40 +0800
committerSasha Levin <sashal@kernel.org>2024-03-26 18:22:37 -0400
commitd746889db75a76aeee95fb705b8e1ac28c684a2e (patch)
treee0b04c093838018e64943ce1c276f450a16c142c
parent7089428a1a4e28efa0c36877d80639a8306fdbf4 (diff)
downloadlinux-stable-d746889db75a76aeee95fb705b8e1ac28c684a2e.tar.gz
linux-stable-d746889db75a76aeee95fb705b8e1ac28c684a2e.tar.bz2
linux-stable-d746889db75a76aeee95fb705b8e1ac28c684a2e.zip
nfp: flower: handle acti_netdevs allocation failure
[ Upstream commit 84e95149bd341705f0eca6a7fcb955c548805002 ] 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> Reviewed-by: Louis Peens <louis.peens@corigine.com> Link: https://lore.kernel.org/r/20240308142540.9674-1-duoming@zju.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/lag_conf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c
index bf10598f66ae..1b5e0cef9771 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c
@@ -336,6 +336,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