Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp623048pxj; Thu, 20 May 2021 18:12:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHciYAZCFxDMlDIPmavaA4bWwx3TrCieaAY5zv37LDW/zEcE0Jngzr1BBBs6Zv+uPizRf4 X-Received: by 2002:a17:906:ff4b:: with SMTP id zo11mr5843792ejb.345.1621559542803; Thu, 20 May 2021 18:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621559542; cv=none; d=google.com; s=arc-20160816; b=WLjAYYmVWBw94mzqBVDn6XP4vu8/P0dWzFgWMm4i6kWs0d4086d3SGgHQZuUu6PxJr nR7Wn1+yzdDyKriCkEPnBK4PsencrP61Wp3aeeuyVwcX8xDCrD1znJkuvZiDduuKKqA/ RIDvLTcHqsBBc23+CyMYtUxksXMfN2P4eQnbjUmdKa5n6U1vgWbLRY4Qtc9tbAfFzyhc fVjreyKGIp3Q/nA4QxVKZGMp06cJqkPrv7UJto76PVRRtlxHQwKTU0jx8Q5jmyqKCnpm P/cO1Tmt23Uj+87D2EewtmPpbrS5WvC2YPq02SlxOBnL8zo4HfWpcq/bCI+xNBemi7PK uYYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gpcxHKtpRSDVgdSh842lVpoqknLMSFvS9HPnSRBY2Dc=; b=OhiU9RssjD0KofC3ZHM7+ZXe8do6gpAALRepBIXJXW2ThA+41C/AD2qv8Mdk3ZcbCS 0cHvb1UJ/QwfgQGVZzTfUdRF7wFrGZqKBi5uRL1UFIqcw2v0SXVhxAU+NGR0h4YDzBVg c5w2r06mmfKl321LRM7A+Ucva8sm0m7rlLTMyRpq1GWTQF9BX/VNLUsPbNTv7F3cu2Ru OpnUd8GQzdPLFQje/06CT3bTK865NTf95A/LiN2JnU0wVy6ZJVYT7zl/lm75qO+PPr+I wtHIjkmp1uijhFmUJUOZK5ScK5cHpNtf2U8fRXMFH4CaevxHt/8m4shw9HUxigGvHGVz jDYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IT7ihLf5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si4260204edv.466.2021.05.20.18.11.53; Thu, 20 May 2021 18:12:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IT7ihLf5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241503AbhETLkv (ORCPT + 99 others); Thu, 20 May 2021 07:40:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:41738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239731AbhETLUK (ORCPT ); Thu, 20 May 2021 07:20:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5928961D80; Thu, 20 May 2021 10:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505454; bh=TL5/raBl4V3mggEkUzIXLeXN+pFW1tGlv1AiYVBfIRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IT7ihLf5GLu/mg3MFVnb+ZceNRtJu3NRz0c2luAOms2iOI97Wl3sxdqUjsOfY/yv4 GuXHveO7I/cNVNqEKTi395N2GQKoQiBzP9p5avixAa/tpXIKdeG/TNdQt2S7FZ/ocu IKN6CJlaTUQDTXOzuORBwoyfCYxMMa12sSUgNOKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Archie Pusaka , syzbot+338f014a98367a08a114@syzkaller.appspotmail.com, Alain Michaud , Abhishek Pandit-Subedi , Guenter Roeck , Marcel Holtmann , Sasha Levin Subject: [PATCH 4.4 141/190] Bluetooth: Set CONF_NOT_COMPLETE as l2cap_chan default Date: Thu, 20 May 2021 11:23:25 +0200 Message-Id: <20210520092106.851085892@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Archie Pusaka [ Upstream commit 3a9d54b1947ecea8eea9a902c0b7eb58a98add8a ] Currently l2cap_chan_set_defaults() reset chan->conf_state to zero. However, there is a flag CONF_NOT_COMPLETE which is set when creating the l2cap_chan. It is suggested that the flag should be cleared when l2cap_chan is ready, but when l2cap_chan_set_defaults() is called, l2cap_chan is not yet ready. Therefore, we must set this flag as the default. Example crash call trace: __dump_stack lib/dump_stack.c:15 [inline] dump_stack+0xc4/0x118 lib/dump_stack.c:56 panic+0x1c6/0x38b kernel/panic.c:117 __warn+0x170/0x1b9 kernel/panic.c:471 warn_slowpath_fmt+0xc7/0xf8 kernel/panic.c:494 debug_print_object+0x175/0x193 lib/debugobjects.c:260 debug_object_assert_init+0x171/0x1bf lib/debugobjects.c:614 debug_timer_assert_init kernel/time/timer.c:629 [inline] debug_assert_init kernel/time/timer.c:677 [inline] del_timer+0x7c/0x179 kernel/time/timer.c:1034 try_to_grab_pending+0x81/0x2e5 kernel/workqueue.c:1230 cancel_delayed_work+0x7c/0x1c4 kernel/workqueue.c:2929 l2cap_clear_timer+0x1e/0x41 include/net/bluetooth/l2cap.h:834 l2cap_chan_del+0x2d8/0x37e net/bluetooth/l2cap_core.c:640 l2cap_chan_close+0x532/0x5d8 net/bluetooth/l2cap_core.c:756 l2cap_sock_shutdown+0x806/0x969 net/bluetooth/l2cap_sock.c:1174 l2cap_sock_release+0x64/0x14d net/bluetooth/l2cap_sock.c:1217 __sock_release+0xda/0x217 net/socket.c:580 sock_close+0x1b/0x1f net/socket.c:1039 __fput+0x322/0x55c fs/file_table.c:208 ____fput+0x17/0x19 fs/file_table.c:244 task_work_run+0x19b/0x1d3 kernel/task_work.c:115 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0xe4c/0x204a kernel/exit.c:766 do_group_exit+0x291/0x291 kernel/exit.c:891 get_signal+0x749/0x1093 kernel/signal.c:2396 do_signal+0xa5/0xcdb arch/x86/kernel/signal.c:737 exit_to_usermode_loop arch/x86/entry/common.c:243 [inline] prepare_exit_to_usermode+0xed/0x235 arch/x86/entry/common.c:277 syscall_return_slowpath+0x3a7/0x3b3 arch/x86/entry/common.c:348 int_ret_from_sys_call+0x25/0xa3 Signed-off-by: Archie Pusaka Reported-by: syzbot+338f014a98367a08a114@syzkaller.appspotmail.com Reviewed-by: Alain Michaud Reviewed-by: Abhishek Pandit-Subedi Reviewed-by: Guenter Roeck Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index f2db50da8ce2..515f3e52f70a 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -499,7 +499,9 @@ void l2cap_chan_set_defaults(struct l2cap_chan *chan) chan->flush_to = L2CAP_DEFAULT_FLUSH_TO; chan->retrans_timeout = L2CAP_DEFAULT_RETRANS_TO; chan->monitor_timeout = L2CAP_DEFAULT_MONITOR_TO; + chan->conf_state = 0; + set_bit(CONF_NOT_COMPLETE, &chan->conf_state); set_bit(FLAG_FORCE_ACTIVE, &chan->flags); } -- 2.30.2