Received: by 10.223.185.116 with SMTP id b49csp6383125wrg; Wed, 28 Feb 2018 08:30:46 -0800 (PST) X-Google-Smtp-Source: AH8x225fSryWQWNrX00y7NJoHgRjthy6+d/bZJoj17YXXSR27NZKtx66Ik5WW1R05hYhEvbi/Euo X-Received: by 2002:a17:902:a705:: with SMTP id w5-v6mr18158650plq.299.1519835446263; Wed, 28 Feb 2018 08:30:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519835446; cv=none; d=google.com; s=arc-20160816; b=tifOlZdX/NhPaIQggrPgWXFQ2LCvmieu78Je1UAng8CxRfO/wT5TuGEGmhIIC46UtP kPAbDFmRbfPS1Ow2p6zR44VbvzECidkffSL+AQrgnhoc+E0tZZSLjAbX6NAReArDhRPK TARTlXMXk5krSjZiWsj4B/d3bcSCNWvRYkQD2bQCuxNlboOEJMtsfrwh97fHYd2/fyEs 4xbaK+WNhwN10gXaD3pkQhv8/fGXRlEmYWEdSDM4XivEVCb6gR/uoPxuuxwjwZveYcxV A4qRv6m3OQxxXPV0BqSF2sqWbYL/vmLeCf5qezfGrK+sIlTQwnwM7uUINKO9QT+BHGNj b6lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=xGRDG/rNXxTH3arx1/xTgY2CJu8mOxxQPr8UB6Mr+MU=; b=SN2t+0eKJOJlbmTuTfYN/JSueRCi1DegtlnRR8WyeV4HbQB64shrSTXf/2L5lQ2Yme AuSsxaNyCFpb5zhkYevPJ7N2b6gwXVEtwWMT+FOzckHyZXeCi0SLZUBkH7iAKBA1YNeK u11ZoJ5IXaMGVic6qG2+GtLmVS50tHTIdWD55u8ZLVdevB+dCwTQ+YfMRXvT6iymDcUm QC82GRN31SeI8n+EwRESiS6fP+1UsitB2kmAIvXijlvHXqDXaXqQ+BWus5JSjob+hMaB MecQsORqoFJdKNIYVz3yqeXS5LgAFzYUpRLOPVK1niBoqkSd8ub1kEYZSHA1U1mHYSHr 8ocw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si1220727pge.263.2018.02.28.08.30.31; Wed, 28 Feb 2018 08:30:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934463AbeB1Q3z (ORCPT + 99 others); Wed, 28 Feb 2018 11:29:55 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35170 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934792AbeB1QPU (ORCPT ); Wed, 28 Feb 2018 11:15:20 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yp-0006XQ-PR; Wed, 28 Feb 2018 15:22:28 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yj-0000GK-Sf; Wed, 28 Feb 2018 15:22:21 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Dominik Brodowski" , "Johannes Berg" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 205/254] nl80211: take RCU read lock when calling ieee80211_bss_get_ie() In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Dominik Brodowski commit 7a94b8c2eee7083ddccd0515830f8c81a8e44b1a upstream. As ieee80211_bss_get_ie() derefences an RCU to return ssid_ie, both the call to this function and any operation on this variable need protection by the RCU read lock. Fixes: 44905265bc15 ("nl80211: don't expose wdev->ssid for most interfaces") Signed-off-by: Dominik Brodowski Signed-off-by: Johannes Berg Signed-off-by: Ben Hutchings --- net/wireless/nl80211.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2354,12 +2354,13 @@ static int nl80211_send_iface(struct sk_ const u8 *ssid_ie; if (!wdev->current_bss) break; + rcu_read_lock(); ssid_ie = ieee80211_bss_get_ie(&wdev->current_bss->pub, WLAN_EID_SSID); - if (!ssid_ie) - break; - if (nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2)) - goto nla_put_failure_locked; + if (ssid_ie && + nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2)) + goto nla_put_failure_rcu_locked; + rcu_read_unlock(); break; } default: @@ -2370,6 +2371,8 @@ static int nl80211_send_iface(struct sk_ return genlmsg_end(msg, hdr); + nla_put_failure_rcu_locked: + rcu_read_unlock(); nla_put_failure_locked: wdev_unlock(wdev); nla_put_failure: