Received: by 10.223.185.116 with SMTP id b49csp6373913wrg; Wed, 28 Feb 2018 08:21:45 -0800 (PST) X-Google-Smtp-Source: AH8x224hXNGd1iUTHgk2/Jz399ZjF4Mf/sMdUMzeu5qUNp9xk97X5ZZO62QT0nGCwkVn0z8ST71Y X-Received: by 10.99.171.10 with SMTP id p10mr14530865pgf.176.1519834905261; Wed, 28 Feb 2018 08:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519834905; cv=none; d=google.com; s=arc-20160816; b=KBDDaMHioabRjbsbzGg1cyHi/JmBTw6RmxIue4gjwQjzPq2SiFAgZJ9o+yYDNJU2hI tBUrpyQKgctLnLmsWMDYK/Bek+DMNrkgaxONggh7fFbmwu7CkGaMHHem2mfWjS+mueeX dcC/g9XSuhhdwiW5YBXKVbV9IIO2UZ6osGJrg7MYf51ONee3kljinD9dWueIv8HpJvXs aR0X4h0/HWeZQruGdXFqg29EVMhT0ZsafxxwCY5oZT3nF5JtaLGeltjDnMzoDcZ7tB/C XXBtYUUJPnc1i/pQRPjJp7t6Fx2Yw/ZISMv1lq55rk2C1Eg7V34HiT1ZW6i330v8cRXW Xq+A== 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=I59EIRmwpo2hPdSWhwZdmxe9pwav4by40Y5KMInqj08=; b=vX/hezFkbQ2C70WXRX1PS6y2xBYCur3K59/V8fH62a0zEV9yDgwiDiNb9apJlfikww BhsR8qx1DkbGJ2Eo4GugSYykJz1s1AFSavryVT4RFq7Bo0hUtGnoqxjL/Jfw/10QfKcr JweEtHxs/3PoAR6HuRwHmZXjfntwnb51xV/RH/77Ks00fJHjFsPzj4DJv1QFNEorVuNn TlIDpBMd8+NPmjCAms79wnPKeKg6dmj0FunSJQRRBp6bgFYbN3MBwdSm6xmxmjmqjU4G wtETdKTI+eGPh0lltHoVpWV7J9ftTqKk3YqOJmcnfmYmTvLyUP/0BfEjRV5tr33Qr0xi GFHw== 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 l30-v6si1086800plg.346.2018.02.28.08.21.30; Wed, 28 Feb 2018 08:21:45 -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 S934984AbeB1QUL (ORCPT + 99 others); Wed, 28 Feb 2018 11:20:11 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35315 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932479AbeB1QUI (ORCPT ); Wed, 28 Feb 2018 11:20:08 -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 1er3Yt-0006XQ-HX; Wed, 28 Feb 2018 15:22:31 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yf-0008VH-LX; Wed, 28 Feb 2018 15:22:17 +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, "Johannes Berg" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 085/254] nl80211: fix nl80211_send_iface() error paths 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: Johannes Berg commit 4564b187c16327045d87596e8980c65ba7b84c50 upstream. Evidently I introduced a locking bug in my change here, the nla_put_failure sometimes needs to unlock. Fix it. Fixes: 44905265bc15 ("nl80211: don't expose wdev->ssid for most interfaces") Signed-off-by: Johannes Berg Signed-off-by: Ben Hutchings --- net/wireless/nl80211.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2346,7 +2346,7 @@ static int nl80211_send_iface(struct sk_ case NL80211_IFTYPE_AP: if (wdev->ssid_len && nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid)) - goto nla_put_failure; + goto nla_put_failure_locked; break; case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: @@ -2359,7 +2359,7 @@ static int nl80211_send_iface(struct sk_ if (!ssid_ie) break; if (nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2)) - goto nla_put_failure; + goto nla_put_failure_locked; break; } default: @@ -2370,6 +2370,8 @@ static int nl80211_send_iface(struct sk_ return genlmsg_end(msg, hdr); + nla_put_failure_locked: + wdev_unlock(wdev); nla_put_failure: genlmsg_cancel(msg, hdr); return -EMSGSIZE;