Skip to content

Commit 84e9514

Browse files
stonezdmkuba-moo
authored andcommitted
nfp: flower: handle acti_netdevs allocation failure
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: bb9a8d0 ("nfp: flower: monitor and offload LAG groups") Signed-off-by: Duoming Zhou <[email protected]> Reviewed-by: Louis Peens <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 46590b5 commit 84e9514

File tree

1 file changed

+5
-0
lines changed
  • drivers/net/ethernet/netronome/nfp/flower

1 file changed

+5
-0
lines changed

drivers/net/ethernet/netronome/nfp/flower/lag_conf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,11 @@ static void nfp_fl_lag_do_work(struct work_struct *work)
337337

338338
acti_netdevs = kmalloc_array(entry->slave_cnt,
339339
sizeof(*acti_netdevs), GFP_KERNEL);
340+
if (!acti_netdevs) {
341+
schedule_delayed_work(&lag->work,
342+
NFP_FL_LAG_DELAY);
343+
continue;
344+
}
340345

341346
/* Include sanity check in the loop. It may be that a bond has
342347
* changed between processing the last notification and the

0 commit comments

Comments
 (0)