From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8769C7EE22 for ; Thu, 4 May 2023 19:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231933AbjEDT44 (ORCPT ); Thu, 4 May 2023 15:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231990AbjEDTzB (ORCPT ); Thu, 4 May 2023 15:55:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8577931B03; Thu, 4 May 2023 12:48:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F420B637CE; Thu, 4 May 2023 19:48:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0773EC4339B; Thu, 4 May 2023 19:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683229701; bh=bpt8Pleh5MT2glcM/SjsemrlW8FxOcpaTz+l4JWV86E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VUV+2jnrHjDH7k6H+rH+r0nOHXT4alR+GLA38mxqBMp11ytdKSxL4JCPnENRrIUTP BeaUPXeC2H8P2X1QVvkM+M70jhc+X573wWRkb//xgFEezfFSlcvGZ/wRR6+rSUlW8B 72T152E0jO2fjSiF8U478MT4WA+MyBuutDI9lUs4RSsWOnzCZnsDmczmE6K7EAlbYf Tqf6fko0yY9x+3+M+Mlhb02mc5YkkL6uYTBQyCjsykxVniNsC6LhY9IxdATuDXOoHP XzzELqxUXU3UBV2h9dQNGp4VZsZIVJGUnZsRF5k/K8s73Wd8Q8SOIRFP9jadLXYt0L w4iszbqVoPNUg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Min Li , syzbot+9519d6b5b79cf7787cf3@syzkaller.appspotmail.com, Luiz Augusto von Dentz , Sasha Levin , marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 48/49] Bluetooth: L2CAP: fix "bad unlock balance" in l2cap_disconnect_rsp Date: Thu, 4 May 2023 15:46:25 -0400 Message-Id: <20230504194626.3807438-48-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230504194626.3807438-1-sashal@kernel.org> References: <20230504194626.3807438-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Min Li [ Upstream commit 25e97f7b1866e6b8503be349eeea44bb52d661ce ] conn->chan_lock isn't acquired before l2cap_get_chan_by_scid, if l2cap_get_chan_by_scid returns NULL, then 'bad unlock balance' is triggered. Reported-by: syzbot+9519d6b5b79cf7787cf3@syzkaller.appspotmail.com Link: https://lore.kernel.org/all/000000000000894f5f05f95e9f4d@google.com/ Signed-off-by: Min Li Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index e62dadad81b31..ee8f806534dfb 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4694,7 +4694,6 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, chan = l2cap_get_chan_by_scid(conn, scid); if (!chan) { - mutex_unlock(&conn->chan_lock); return 0; } -- 2.39.2