From: Dan Carpenter <dan.carpenter@oracle.com>
To: Peter Lafreniere <pjlafren@mtu.edu>
Cc: linux-hams@vger.kernel.org, ralf@linux-mips.org, netdev@vger.kernel.org
Subject: Re: [PATCH] ax25: use GFP_KERNEL over GFP_ATOMIC where possible
Date: Mon, 6 Jun 2022 14:50:59 +0300 [thread overview]
Message-ID: <20220606115058.GV2146@kadam> (raw)
In-Reply-To: <20220602112138.8200-1-pjlafren@mtu.edu>
On Thu, Jun 02, 2022 at 07:21:38AM -0400, Peter Lafreniere wrote:
> net/ax25/ax25_dev.c | 4 ++--
> net/ax25/ax25_route.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c
> index d2a244e1c260..b264904980a8 100644
> --- a/net/ax25/ax25_dev.c
> +++ b/net/ax25/ax25_dev.c
> @@ -52,7 +52,7 @@ void ax25_dev_device_up(struct net_device *dev)
> {
> ax25_dev *ax25_dev;
>
> - if ((ax25_dev = kzalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) {
> + if ((ax25_dev = kzalloc(sizeof(*ax25_dev), GFP_KERNEL)) == NULL) {
> printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n");
> return;
> }
> @@ -60,7 +60,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;
> - dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_ATOMIC);
> + dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_KERNEL);
> ax25_dev->forward = NULL;
>
> ax25_dev->values[AX25_VALUES_IPDEFMODE] = AX25_DEF_IPDEFMODE;
These two are fine.
> diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
> index b7c4d656a94b..c77b848ccfc7 100644
> --- a/net/ax25/ax25_route.c
> +++ b/net/ax25/ax25_route.c
> @@ -91,7 +91,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
> kfree(ax25_rt->digipeat);
> ax25_rt->digipeat = NULL;
> if (route->digi_count != 0) {
> - if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
> + if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_KERNEL)) == NULL) {
> write_unlock_bh(&ax25_route_lock);
This write lock means it has to be GFP_ATOMIC.
> ax25_dev_put(ax25_dev);
> return -ENOMEM;
> @@ -110,7 +110,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
> ax25_rt = ax25_rt->next;
> }
>
> - if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_ATOMIC)) == NULL) {
> + if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_KERNEL)) == NULL) {
> write_unlock_bh(&ax25_route_lock);
This change is buggy as well.
> ax25_dev_put(ax25_dev);
> return -ENOMEM;
regards,
dan carpenter
prev parent reply other threads:[~2022-06-06 11:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 11:21 [PATCH] ax25: use GFP_KERNEL over GFP_ATOMIC where possible Peter Lafreniere
2022-06-03 2:47 ` Jakub Kicinski
2022-06-06 11:50 ` Dan Carpenter [this message]
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=20220606115058.GV2146@kadam \
--to=dan.carpenter@oracle.com \
--cc=linux-hams@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pjlafren@mtu.edu \
--cc=ralf@linux-mips.org \
/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).