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; } From patchwork Fri Aug 26 15:25:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101931 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp412206qga; Fri, 26 Aug 2016 08:29:01 -0700 (PDT) X-Received: by 10.66.216.69 with SMTP id oo5mr6966578pac.155.1472225341154; Fri, 26 Aug 2016 08:29:01 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yp6si21699224pac.253.2016.08.26.08.29.01; Fri, 26 Aug 2016 08:29:01 -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 S1752855AbcHZP2m (ORCPT + 4 others); Fri, 26 Aug 2016 11:28:42 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:49923 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584AbcHZP2k (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 0LqpCY-1b9Aws0SwM-00eM1x; Fri, 26 Aug 2016 17:26:56 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Arnd Bergmann , Hadar Hen Zion , Jiri Pirko , "David S . Miller" , netdev@vger.kernel.org Subject: [PATCH 4/5] net_sched: fix use of uninitialized ethertype variable in cls_flower Date: Fri, 26 Aug 2016 17:25:45 +0200 Message-Id: <20160826152546.604384-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160826152546.604384-1-arnd@arndb.de> References: <20160826152546.604384-1-arnd@arndb.de> X-Provags-ID: V03:K0:XM3PnCWMThejU6AsjZRdb4x8QDoWrdrAL/zaHsjgvs6rvA6PmY2 /5t+nNIqUx7HxUjC8br0wBXejfaMn1kagAHPV6gZMR0eSTnrlw1QKSbV1CTimpMtqyMLt1r P8JbKmVyBbgPgN3xMdDaVPVpWKhG4+vDhm16F54TFNQbxoRjxkOsRI+HJm8SAOtBEAyFilF q9v3eijJqBV5WPofvbpPg== X-UI-Out-Filterresults: notjunk:1; V01:K0:ils/9vcfPGk=:Kd9LF8VNDq4Eg9iUJEdX0c uEwwUnNoyEyRlfncIt6Lz0eBNBCWzFJAzqzweeIO1zH6yJDubWw59HubWskT5tez6zkfRqnwk xuCf6hpnRHpMWHL5CHiz7N70M1Yb4FqYagu4l9IpQ9e0kwtcGWMn1zBGzUD5OyIhVe78+b59m nnO7rHN/C8OJpCz/5nKPyWA9NW2woDKQEwHTzRkluUdXucZtZano74e/6/SouY2OcPrBwJNkZ Z4cEJQJIPNnK/AVFIPapR+cjEG5nQTFpCGMjqXKfrhcpB31XU5gjhi9x/hbrwyiRQIc2Lb9wx vxuEpH0OjAy7l8DRXnnua97wPXohRCuHbmc8ejs8LInPqUmK5D0k1Rw7fWyrRq/L9N+qTaBSa Ap5pk2ZanH+48dYlz+AfW5oAglU/KyjgEctWIvblDvX4vhj7tzBRyA7Ie7qWHSTN23KpXGfJm IiD0VfMAKk9vsqnwa3yjycS/6udq0b4MopP/cBbXafXGQQJ8ZCX9DRSsSyS3w2H83/vXhmp/v qTpbeYe9+q8djwwhzvQ9Dr1zGCZYoCCO8uc9y0NfmbMOWYqI72VBd0YJMJG+MbT7RyIHMbw5p 2L2Izb++uIXMKhyxWuruBOYRz6lZQJed+hsfqHS6XKqvP++Wx24NmYfC1tvimlATGlDDSrCp7 KqBGaKrz32V3m/dx44tYnWBfChRXvuxf5QH/UwC4mu8ggoKaf7/Fd8KxqqTJ24vWa4rk= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The addition of VLAN support caused a possible use of uninitialized data if we encounter a zero TCA_FLOWER_KEY_ETH_TYPE key, as pointed out by "gcc -Wmaybe-uninitialized": net/sched/cls_flower.c: In function 'fl_change': net/sched/cls_flower.c:366:22: error: 'ethertype' may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes the code to only set the ethertype field if it was nonzero, as before the patch. Signed-off-by: Arnd Bergmann Fixes: 9399ae9a6cb2 ("net_sched: flower: Add vlan support") Cc: Hadar Hen Zion Cc: Jiri Pirko --- Cc: David S. Miller Cc: netdev@vger.kernel.org net/sched/cls_flower.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) -- 2.9.0 diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 532ab6751343..cf9ad5b50889 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -353,18 +353,19 @@ static int fl_set_key(struct net *net, struct nlattr **tb, mask->eth.src, TCA_FLOWER_KEY_ETH_SRC_MASK, sizeof(key->eth.src)); - if (tb[TCA_FLOWER_KEY_ETH_TYPE]) + if (tb[TCA_FLOWER_KEY_ETH_TYPE]) { ethertype = nla_get_be16(tb[TCA_FLOWER_KEY_ETH_TYPE]); - if (ethertype == htons(ETH_P_8021Q)) { - fl_set_key_vlan(tb, &key->vlan, &mask->vlan); - fl_set_key_val(tb, &key->basic.n_proto, - TCA_FLOWER_KEY_VLAN_ETH_TYPE, - &mask->basic.n_proto, TCA_FLOWER_UNSPEC, - sizeof(key->basic.n_proto)); - } else { - key->basic.n_proto = ethertype; - mask->basic.n_proto = cpu_to_be16(~0); + if (ethertype == htons(ETH_P_8021Q)) { + fl_set_key_vlan(tb, &key->vlan, &mask->vlan); + fl_set_key_val(tb, &key->basic.n_proto, + TCA_FLOWER_KEY_VLAN_ETH_TYPE, + &mask->basic.n_proto, TCA_FLOWER_UNSPEC, + sizeof(key->basic.n_proto)); + } else { + key->basic.n_proto = ethertype; + mask->basic.n_proto = cpu_to_be16(~0); + } } if (key->basic.n_proto == htons(ETH_P_IP) ||