diff options
author | Peter Lafreniere <pjlafren@mtu.edu> | 2022-06-16 11:23:33 -0400 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-06-17 20:34:13 -0700 |
commit | f0623340fd2cab724e3c54ac026d1414325f375d (patch) | |
tree | 1287dcc6e328ce477a410f9147c302c3b1682c96 /net/ax25/ax25_dev.c | |
parent | f691b4d87edfd3fb37ad589d38cf858f47c6e050 (diff) |
ax25: use GFP_KERNEL in ax25_dev_device_up()
ax25_dev_device_up() is only called during device setup, which is
done in user context. In addition, ax25_dev_device_up()
unconditionally calls ax25_register_dev_sysctl(), which already
allocates with GFP_KERNEL.
Since it is allowed to sleep in this function, here we change
ax25_dev_device_up() to use GFP_KERNEL to reduce unnecessary
out-of-memory errors.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peter Lafreniere <pjlafren@mtu.edu>
Link: https://lore.kernel.org/r/20220616152333.9812-1-pjlafren@mtu.edu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ax25/ax25_dev.c')
-rw-r--r-- | net/ax25/ax25_dev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c index ab88b6ac5401..c5462486dbca 100644 --- a/net/ax25/ax25_dev.c +++ b/net/ax25/ax25_dev.c @@ -52,7 +52,8 @@ void ax25_dev_device_up(struct net_device *dev) { ax25_dev *ax25_dev; - if ((ax25_dev = kzalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) { + ax25_dev = kzalloc(sizeof(*ax25_dev), GFP_KERNEL); + if (!ax25_dev) { printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n"); return; } @@ -60,7 +61,7 @@ void ax25_dev_device_up(struct net_device *dev) refcount_set(&ax25_dev->refcount, 1); dev->ax25_ptr = ax25_dev; ax25_dev->dev = dev; - netdev_hold(dev, &ax25_dev->dev_tracker, GFP_ATOMIC); + netdev_hold(dev, &ax25_dev->dev_tracker, GFP_KERNEL); ax25_dev->forward = NULL; ax25_dev->device_up = true; |