public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 3/5] rxrpc: fix last_call processing
Date: Sat, 27 Aug 2016 08:01:42 +0100	[thread overview]
Message-ID: <4145.1472281302@warthog.procyon.org.uk> (raw)
In-Reply-To: <20160826152546.604384-4-arnd@arndb.de>

Arnd Bergmann <arnd@arndb.de> wrote:

> A change to the retransmission handling in rxrpc caused a use-before-init
> bug in rxrpc_data_ready(), as indicated by "gcc -Wmaybe-uninitialized":
> 
> net/rxrpc/input.c: In function 'rxrpc_data_ready':
> net/rxrpc/input.c:735:34: error: 'call' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This moves the initialization of the local variable before the first
> user, which presumably is what was intended here.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 18bfeba50dfd ("rxrpc: Perform terminal call ACK/ABORT retransmission from conn processor")
> ---
> Cc: David Howells <dhowells@redhat.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> 
>  net/rxrpc/input.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
> index 66cdeb56f44f..3c22e43a58fd 100644
> --- a/net/rxrpc/input.c
> +++ b/net/rxrpc/input.c
> @@ -728,6 +728,10 @@ void rxrpc_data_ready(struct sock *sk)
>  		if (sp->hdr.callNumber < chan->last_call)
>  			goto discard_unlock;
>  
> +		call = rcu_dereference(chan->call);
> +		if (!call || atomic_read(&call->usage) == 0)
> +			goto cant_route_call;
> +
>  		if (sp->hdr.callNumber == chan->last_call) {
>  			/* For the previous service call, if completed
>  			 * successfully, we discard all further packets.
> @@ -744,10 +748,6 @@ void rxrpc_data_ready(struct sock *sk)
>  			goto out_unlock;
>  		}
>  
> -		call = rcu_dereference(chan->call);
> -		if (!call || atomic_read(&call->usage) == 0)
> -			goto cant_route_call;
> -
>  		rxrpc_post_packet_to_call(call, skb);
>  		goto out_unlock;
>  	}

You can't rearrange these like this.  I have a different fix.

David

  reply	other threads:[~2016-08-27  7:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26 15:25 [PATCH 0/5] -Wmaybe-uninitialized bug fixes for linux-next Arnd Bergmann
2016-08-26 15:25 ` [PATCH 1/5] gpio: pca954x: fix undefined error code from remove Arnd Bergmann
2016-08-26 15:47   ` Phil Reid
2016-09-07 14:15   ` Linus Walleij
2016-08-26 15:25 ` [PATCH 2/5] video: ARM CLCD: fix endpoint lookup logic Arnd Bergmann
2016-08-29 13:18   ` Linus Walleij
2016-08-29 13:41     ` Arnd Bergmann
2016-08-30  8:35     ` Tomi Valkeinen
2016-08-26 15:25 ` [PATCH 3/5] rxrpc: fix last_call processing Arnd Bergmann
2016-08-27  7:01   ` David Howells [this message]
2016-08-28  8:42   ` David Howells
2016-08-31 11:53     ` Arnd Bergmann
2016-08-31 20:58       ` David Howells
2016-08-26 15:25 ` [PATCH 4/5] net_sched: fix use of uninitialized ethertype variable in cls_flower Arnd Bergmann
2016-08-29  4:30   ` David Miller
2016-08-26 15:25 ` [PATCH 5/5] net/xgene: fix error handling during reset Arnd Bergmann
2016-08-29  4:31   ` 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=4145.1472281302@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.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