Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1470821

[PATCH 3/5] rxrpc: fix last_call processing

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH 3/5] rxrpc: fix last_call processing
Date 2016-08-26 17:40 +0200
Message-ID <saroB-ua-17@gated-at.bofh.it> (permalink)
References <sareW-qT-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;
 	}
-- 
2.9.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] -Wmaybe-uninitialized bug fixes for linux-next Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
  [PATCH 3/5] rxrpc: fix last_call processing Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
    Re: [PATCH 3/5] rxrpc: fix last_call processing David Howells <dhowells@redhat.com> - 2016-08-27 09:10 +0200
    Re: [PATCH 3/5] rxrpc: fix last_call processing David Howells <dhowells@redhat.com> - 2016-08-28 10:50 +0200
      Re: [PATCH 3/5] rxrpc: fix last_call processing Arnd Bergmann <arnd@arndb.de> - 2016-08-31 14:00 +0200
        Re: [PATCH 3/5] rxrpc: fix last_call processing David Howells <dhowells@redhat.com> - 2016-08-31 23:00 +0200
  [PATCH 1/5] gpio: pca954x: fix undefined error code from remove Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
    Re: [PATCH 1/5] gpio: pca954x: fix undefined error code from remove Phil Reid <preid@electromag.com.au> - 2016-08-26 17:50 +0200
    Re: [PATCH 1/5] gpio: pca954x: fix undefined error code from remove Linus Walleij <linus.walleij@linaro.org> - 2016-09-07 16:20 +0200
  [PATCH 4/5] net_sched: fix use of uninitialized ethertype variable in cls_flower Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
    Re: [PATCH 4/5] net_sched: fix use of uninitialized ethertype  variable in cls_flower David Miller <davem@davemloft.net> - 2016-08-29 06:40 +0200

csiph-web