netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jan Rafaj <jr+netfilter-devel@cedric.unob.cz>,
	"David S. Miller" <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH] ax25: Fix SIOCAX25GETINFO ioctl
Date: Sun, 20 Sep 2009 18:32:55 +0200	[thread overview]
Message-ID: <4AB65937.8010508@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.0909201226001.29572@cedric.unob.cz>

Jan Rafaj a écrit :
> 
> Hello Eric,
> 
> Your commit 31e6d363abcd0d05766c82f1a9c905a4c974a199 introduces (among
> other things):
> 
> diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
> index 61b35b9..da0f64f 100644
> --- a/net/ax25/af_ax25.c
> +++ b/net/ax25/af_ax25.c
> @@ -1780,8 +1781,8 @@ static int ax25_ioctl(struct socket *sock,
> unsigned int cmd, unsigned long arg)
>                 ax25_info.idletimer =
> ax25_display_timer(&ax25->idletimer) / (60 * HZ);
>                 ax25_info.n2count   = ax25->n2count;
>                 ax25_info.state     = ax25->state;
> -               ax25_info.rcv_q     = atomic_read(&sk->sk_rmem_alloc);
> -               ax25_info.snd_q     = atomic_read(&sk->sk_wmem_alloc);
> +               ax25_info.rcv_q     = sk_wmem_alloc_get(sk);
> +               ax25_info.snd_q     = sk_rmem_alloc_get(sk);
>                 ax25_info.vs        = ax25->vs;
>                 ax25_info.vr        = ax25->vr;
>                 ax25_info.va        = ax25->va;
> 
> I believe there is a typo, correctly this should be:
> 
>                 ax25_info.idletimer = ax25_display_timer(&ax25->idletimer)
> / (60 * HZ);
>                 ax25_info.n2count   = ax25->n2count;
>                 ax25_info.state     = ax25->state;
> -               ax25_info.rcv_q     = atomic_read(&sk->sk_rmem_alloc);
> -               ax25_info.snd_q     = atomic_read(&sk->sk_wmem_alloc);
> +               ax25_info.rcv_q     = sk_rmem_alloc_get(sk);
> +               ax25_info.snd_q     = sk_wmem_alloc_get(sk);
>                 ax25_info.vs        = ax25->vs;
>                 ax25_info.vr        = ax25->vr;
>                 ax25_info.va        = ax25->va;
> 
> If this is not fixed in the master, then fix, please.
> 
> Being a total kernel newbie, I've checked it against Greg K-H's 2.6.31.y
> git tree (but I'm quite unsure whether this is the real HEAD of
> latest [most up to date] development master branch), so if you know where
> I should be looking instead, I'll be grateful for any kicking into the
> right direction... (I somehow feel this should probably be the main
> Linus's syndication tree linux/kernel/git/torvalds/linux-2.6.git - feel
> free to correct me on this one please).
> 
> Thanks,
> 
> Jan
> 
> ---
> Jan Rafaj
> University of Defence in Brno
> 

Oops, Jan you are absolutely right, this part of the patch was wrong.

Dont worry, David will push your patch to netdev tree, then to Linus.

Thanks

[PATCH] ax25: Fix SIOCAX25GETINFO ioctl

rcv_q & snd_q initializations were reversed in commit
31e6d363abcd0d05766c82f1a9c905a4c974a199
(net: correct off-by-one write allocations reports)

Signed-off-by: Jan Rafaj <jr+netfilter-devel@cedric.unob.cz>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index da0f64f..d6b1b05 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1781,8 +1781,8 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 		ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ);
 		ax25_info.n2count   = ax25->n2count;
 		ax25_info.state     = ax25->state;
-		ax25_info.rcv_q     = sk_wmem_alloc_get(sk);
-		ax25_info.snd_q     = sk_rmem_alloc_get(sk);
+		ax25_info.rcv_q     = sk_rmem_alloc_get(sk);
+		ax25_info.snd_q     = sk_wmem_alloc_get(sk);
 		ax25_info.vs        = ax25->vs;
 		ax25_info.vr        = ax25->vr;
 		ax25_info.va        = ax25->va;

       reply	other threads:[~2009-09-20 16:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LNX.2.00.0909201226001.29572@cedric.unob.cz>
2009-09-20 16:32 ` Eric Dumazet [this message]
2009-09-22 21:25   ` [PATCH] ax25: Fix SIOCAX25GETINFO ioctl David Miller

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=4AB65937.8010508@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jr+netfilter-devel@cedric.unob.cz \
    --cc=netdev@vger.kernel.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).