Return-Path: 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 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: Subject: [PATCH 3.16 006/410] Bluetooth: hidp_connection_add() unsafe use of l2cap_pi() In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: 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) {