Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2349341imm; Thu, 7 Jun 2018 09:10:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLs1hnd7PwtJVItcRl91sl8nKWQqbqfdEkJzdqufZP/gclX+LD3PWi69alD+v/CD+N7Pmoq X-Received: by 2002:a17:902:2924:: with SMTP id g33-v6mr2719771plb.26.1528387814579; Thu, 07 Jun 2018 09:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528387814; cv=none; d=google.com; s=arc-20160816; b=CywLO0Dl2fyZCGvY0fjsB/lGGPfA+Q78cHQDEM5v19MX49rkDkqmWJaJgO5jh+lpXx lthgT+/cDWPGqennqLfRX3JNM4DSxykQ4S95imSBQiMz9X8JTY0btWZXJ7ICzGBErFZl 263SmNZux4iOQtWJRjbTtCu0TWMhJTu7l1vgtY8wUFz0Mm8cbkBXlWjSa5N4VQmSfgCk 6NQ8IUZ4/oj3UGx1AJlS7EYA97dolHiGhoh8C+HiXPaNRLexVCtx/OHfBYvsMf/tjPtC 7xNq5hMCSFJQNAE3XSsQmC5SO/wwO5TwxKD3ZyDgqPEUbLdwLdkzjIxrtLGPjz6T5ErI PwBA== 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=FbDVi5AS7e0OM9e3SBvkCRis8Qnl1dxh8v0F01/arcg=; b=EDfm2F3rtCkyXCad9SbdVy5pJbs1citskMNSNAZKjPj5GmZI7V/1Swh+LKwsMLMHf3 mfD0zJ/sC9pp4yY6w4Zqzvi2zFlBkbV/TedomaPbmGNUCtOkwmADZxfM6QxN8Hmhks1p IuOlV2lbXvufYNLPeQjWf3okyUgtJCm0+UoB6dZ7h782GTYymAiWdWZkHYdebzshlnkt BT1jUalYJc+nGKIZts14W4uoKIMILeVuESPfO3ZOhIzS37JyEXcqjpm3J+Z3afR7DitL yxUi8m1+eKXmVLvcv3F5DbM5xj9vHOrGAbPZZx6Ievo5CLKsULbyhhsOivLv9C3OwkOD SyWQ== 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 k14-v6si8796390pls.477.2018.06.07.09.10.00; Thu, 07 Jun 2018 09:10:14 -0700 (PDT) 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 S933017AbeFGOJD (ORCPT + 99 others); Thu, 7 Jun 2018 10:09:03 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39102 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932870AbeFGOI6 (ORCPT ); Thu, 7 Jun 2018 10:08:58 -0400 Received: from [148.252.241.226] (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 1fQvay-0005Zo-7d; Thu, 07 Jun 2018 15:08:56 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvax-0002gR-4F; Thu, 07 Jun 2018 15:08:55 +0100 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, "Al Viro" , "Marcel Holtmann" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 006/410] Bluetooth: hidp_connection_add() unsafe use of l2cap_pi() In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 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.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro commit 51bda2bca53b265715ca1852528f38dc67429d9a upstream. it's OK after we'd verified the sockets, but not before that. Signed-off-by: Al Viro Signed-off-by: Marcel Holtmann Signed-off-by: Ben Hutchings --- net/bluetooth/hidp/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -1332,13 +1332,14 @@ int hidp_connection_add(struct hidp_conn { struct hidp_session *session; struct l2cap_conn *conn; - struct l2cap_chan *chan = l2cap_pi(ctrl_sock->sk)->chan; + struct l2cap_chan *chan; int ret; ret = hidp_verify_sockets(ctrl_sock, intr_sock); if (ret) return ret; + chan = l2cap_pi(ctrl_sock->sk)->chan; conn = NULL; l2cap_chan_lock(chan); if (chan->conn) {