From patchwork Fri Aug 26 15:25:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101927 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp412535qga; Fri, 26 Aug 2016 08:29:36 -0700 (PDT) X-Received: by 10.66.66.42 with SMTP id c10mr6916454pat.83.1472225376592; Fri, 26 Aug 2016 08:29:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j21si21723575pfj.191.2016.08.26.08.29.36; Fri, 26 Aug 2016 08:29:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753370AbcHZP25 (ORCPT + 4 others); Fri, 26 Aug 2016 11:28:57 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:51131 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751499AbcHZP2k (ORCPT ); Fri, 26 Aug 2016 11:28:40 -0400 Received: from wuerfel.lan. ([176.0.135.42]) by mrelayeu.kundenserver.de (mreue005) with ESMTPA (Nemesis) id 0MaXEr-1bO6Ug1TzN-00K6Ju; Fri, 26 Aug 2016 17:26:55 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Arnd Bergmann , David Howells , "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH 3/5] rxrpc: fix last_call processing Date: Fri, 26 Aug 2016 17:25:44 +0200 Message-Id: <20160826152546.604384-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160826152546.604384-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lGGHA= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Fixes: 18bfeba50dfd ("rxrpc: Perform terminal call ACK/ABORT retransmission from conn processor") --- Cc: David Howells Cc: "David S. Miller" Cc: netdev@vger.kernel.org net/rxrpc/input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.9.0 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; }