]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/smc: use GFP_ATOMIC allocation in smc_pnet_add_eth()
authorEric Dumazet <edumazet@google.com>
Sun, 6 Feb 2022 14:33:48 +0000 (06:33 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Feb 2022 12:02:49 +0000 (12:02 +0000)
My last patch moved the netdev_tracker_alloc() call to a section
protected by a write_lock().

I should have replaced GFP_KERNEL with GFP_ATOMIC to avoid the infamous:

BUG: sleeping function called from invalid context at include/linux/sched/mm.h:256

Fixes: a9e29fdf3aed ("net/smc: fix ref_tracker issue in smc_pnet_add()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_pnet.c

index fb6331d97185a5db9b4539e7f081e9fa469bc44b..0599246c037690b4b01813956e4af74519277bea 100644 (file)
@@ -382,7 +382,7 @@ static int smc_pnet_add_eth(struct smc_pnettable *pnettable, struct net *net,
                if (ndev) {
                        new_pe->ndev = ndev;
                        netdev_tracker_alloc(ndev, &new_pe->dev_tracker,
-                                            GFP_KERNEL);
+                                            GFP_ATOMIC);
                }
                list_add_tail(&new_pe->list, &pnettable->pnetlist);
                write_unlock(&pnettable->lock);