From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B7401AA793; Mon, 14 Oct 2024 14:29:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728916159; cv=none; b=VCoXiSQoJEVxlxzTD3c+gt4/1kvPf9/Gk1ALCJchnoddyVOO85XxMw2WjoSxKyFOktHIQTPdB4ZNXOcoYOACZdFzWtVfDVwaBuV9iw/kbT1V1evdemgWWSc1G+BoZCPI8Ea9pqVwQHQnvJxhRKpmli8iUOr7/CoszNPMPP+hgC0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728916159; c=relaxed/simple; bh=+IJX+eIp3mx9uq91ouNSKDYIAWschSZjRF+V0Zet4Fw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pGLJGLmvXbBBxmpf4Q9b5HZbgtuFP6PNIfPBTmprhV5/BoxeogJLo+eDe7faXi0kRo57vh8xxGNy2Ya8yX5Yv8FYNgfmp2LIMHKb3PolGMTepWpXc0dQOF8WevsXE+5B6zPvrvrZqoWCwbBZgdcn+D3hEWY9/nLVMj61xRODdR8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zuCJqyuk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zuCJqyuk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 868CCC4CED0; Mon, 14 Oct 2024 14:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728916158; bh=+IJX+eIp3mx9uq91ouNSKDYIAWschSZjRF+V0Zet4Fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zuCJqyukq8esj9hPuKb7vtN3ZdTZNLWs0klAcOvTCgkUL1inux0ilSRPb8ijdrA3e 3Bi3Rj5U217O+txRE0mhtzT3H015yTuDN6JT1piVGvPxkKKd/00PDUq4UhnfUOQZCo USSRVkErl5tjgqPodd5p9Q8IP2MVdUFvp8+e1hks= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+d7ce59b06b3eb14fd218@syzkaller.appspotmail.com, Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.11 102/214] Bluetooth: RFCOMM: FIX possible deadlock in rfcomm_sk_state_change Date: Mon, 14 Oct 2024 16:19:25 +0200 Message-ID: <20241014141048.975150144@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141044.974962104@linuxfoundation.org> References: <20241014141044.974962104@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luiz Augusto von Dentz [ Upstream commit 08d1914293dae38350b8088980e59fbc699a72fe ] rfcomm_sk_state_change attempts to use sock_lock so it must never be called with it locked but rfcomm_sock_ioctl always attempt to lock it causing the following trace: ====================================================== WARNING: possible circular locking dependency detected 6.8.0-syzkaller-08951-gfe46a7dd189e #0 Not tainted ------------------------------------------------------ syz-executor386/5093 is trying to acquire lock: ffff88807c396258 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1671 [inline] ffff88807c396258 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: rfcomm_sk_state_change+0x5b/0x310 net/bluetooth/rfcomm/sock.c:73 but task is already holding lock: ffff88807badfd28 (&d->lock){+.+.}-{3:3}, at: __rfcomm_dlc_close+0x226/0x6a0 net/bluetooth/rfcomm/core.c:491 Reported-by: syzbot+d7ce59b06b3eb14fd218@syzkaller.appspotmail.com Tested-by: syzbot+d7ce59b06b3eb14fd218@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=d7ce59b06b3eb14fd218 Fixes: 3241ad820dbb ("[Bluetooth] Add timestamp support to L2CAP, RFCOMM and SCO") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/rfcomm/sock.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 37d63d768afb8..f48250e3f2e10 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -865,9 +865,7 @@ static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned lon if (err == -ENOIOCTLCMD) { #ifdef CONFIG_BT_RFCOMM_TTY - lock_sock(sk); err = rfcomm_dev_ioctl(sk, cmd, (void __user *) arg); - release_sock(sk); #else err = -EOPNOTSUPP; #endif -- 2.43.0