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 8D1081DED49; Wed, 6 Nov 2024 12:20:47 +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=1730895647; cv=none; b=otR8Mu+fmu3gV3Xf7zzhvaj5pH/WGcZ9hQuTcXderwg1AjyN4tgRDf1/21rFyRs14pJl6BR+6B0Nkl43zczwsdfpGnd7uSAaTNTxT60VWLug8CTW6GctRUBolFYKL8vBjmsWuF8+I9BdKBcQh1hpCE6TfaNTIxgYJqf5av8hey0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730895647; c=relaxed/simple; bh=3MT2PdnG7+R7Imk7mb9KeQR8WnDIrDV057CC71b7tBc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JrVVrSLuOpnCj8oDcXgVyc/7mh4gtxMXFHOBPK0OOMvrBlHwmGtlO+T3DwEvn61OWTGVgxZkXi+UEkdJM/XUJJ+EGkbEbDLkkg6m3g6Lt0kkX3rGE9UemPXiXOgviELnF4mSSJGFSalE1/fjOCFBqFtIZhcqCkWqIb/RVGo/kuY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0oQit5WS; 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="0oQit5WS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13C5BC4CECD; Wed, 6 Nov 2024 12:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730895647; bh=3MT2PdnG7+R7Imk7mb9KeQR8WnDIrDV057CC71b7tBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0oQit5WSYTcyK7o0dKeu3fXmvnjV1DedrUmxG7IKEwfSRnd4iW3UuNO/3qrqUNKho Mrny/at1Lu5WRTBQvE56vDCRXfTaZ6w1FYCsR2Kbkkvk/2nCv8a2OynnNrUstmSEjZ QwNsYuwWX/Xrcs37aHNrwLBsXnNcPU/xhHyowRyQ= 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 4.19 252/350] Bluetooth: RFCOMM: FIX possible deadlock in rfcomm_sk_state_change Date: Wed, 6 Nov 2024 13:03:00 +0100 Message-ID: <20241106120327.141751975@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120320.865793091@linuxfoundation.org> References: <20241106120320.865793091@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-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 78830efe89d73..8f53cc0d9682a 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -872,9 +872,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