Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp557192pxj; Thu, 20 May 2021 16:10:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY3ia536WBEK1enkk9XeH/qH52NamNwgkqPRv6PPKTWv9n9IYBuMoojwCTPVpftcpIch8x X-Received: by 2002:a05:6402:1649:: with SMTP id s9mr7416357edx.35.1621552202870; Thu, 20 May 2021 16:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621552202; cv=none; d=google.com; s=arc-20160816; b=PwYCa323ILFk/GUMHKt2hQJD+CZp7587sutkkGQvXH8+rZHtgnTxNf2eYUJfk6S69d F9l26/r9+ZRev5em0U36dY/Def2eFLN3WcDcyZ05K07LmqhHNIUcMvUvMXcoTVIGw56P finPgwTRfL65qyuwFmnWsWBuSUlAGcSgQOkQab8fmlHhd/gXbYW+JLDybd+K+3rNrg4U 2qLPwoin0MCNm2OeNWZkTrg5cZAwj/sBVpsmPXVteKl09i1ulAZ6w4eP5x+hTquQKi2r uDPLvxKOHp97y7IB57/3s1rCvQF29C9OkAv3yltRWhGBehqUmLqLWbgqEFwGbXYhS1HA vRCg== 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=pRp8S2u8Y6LnfYXvngcyGRFKRvZ6aBu6169YNSmMni0=; b=rXnDwk70ukfLmXheNt0YyiQSBnQaIIN9cIbCXwoqRTPQmWGAK9RYYnG1RULDk30WWz MXjyxOCwrLXMABfD9Vazg+Bchna/eJJCxzY6GimtdGHXDMBtoMcllEGJ4FVMKjym4n9c 04wZM7iu5wuH2x5HeJnceHu3x4QpK0RlVybMAMkHp9VIrzcs/ZFzzBLWJDTqpy0rhUfw /+vNPsT1eVXGIb9Rcacb1KI7I6imFCJ3dei97UXQc19ONQBohrhLbZgeArCEqATQ3ZEP j2Z8a7wOcieEf/XmCmcq17o43tweWE6iKvz2Fm5uEODyqStEO20ErJlxrcwbiQMer9Lm JS7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oQntdVs6; 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 da5si1413469edb.538.2021.05.20.16.09.39; Thu, 20 May 2021 16:10:02 -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=oQntdVs6; 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 S240511AbhETLUl (ORCPT + 99 others); Thu, 20 May 2021 07:20:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:58014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236827AbhETLA3 (ORCPT ); Thu, 20 May 2021 07:00:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2A8361D07; Thu, 20 May 2021 10:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505003; bh=vbZ7pUQk06s1GsGBwbOglzFvRDqryA7w0SmdVJDMFRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oQntdVs65hfCjjXsjVhqcgW1jAkk5E2Np786Fu6zG7Cl3o+ioqvGqsaUD8KVgQf8X PyLN7vQ4QnrX0kFAc0G8wS7cyuuRDfkkUqDm+2bOn06ndcbAV5wfmAhmkTvudLQfSx A75So6ES+Ix7f0EcHHSo3q2DVqQTVflfy5JS9LCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tetsuo Handa , Marcel Holtmann , Sasha Levin , syzbot Subject: [PATCH 4.9 177/240] Bluetooth: initialize skb_queue_head at l2cap_chan_create() Date: Thu, 20 May 2021 11:22:49 +0200 Message-Id: <20210520092114.610909955@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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: Tetsuo Handa [ Upstream commit be8597239379f0f53c9710dd6ab551bbf535bec6 ] syzbot is hitting "INFO: trying to register non-static key." message [1], for "struct l2cap_chan"->tx_q.lock spinlock is not yet initialized when l2cap_chan_del() is called due to e.g. timeout. Since "struct l2cap_chan"->lock mutex is initialized at l2cap_chan_create() immediately after "struct l2cap_chan" is allocated using kzalloc(), let's as well initialize "struct l2cap_chan"->{tx_q,srej_q}.lock spinlocks there. [1] https://syzkaller.appspot.com/bug?extid=fadfba6a911f6bf71842 Reported-and-tested-by: syzbot Signed-off-by: Tetsuo Handa 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 d586caaa3af4..204b6ebd2a24 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -445,6 +445,8 @@ struct l2cap_chan *l2cap_chan_create(void) if (!chan) return NULL; + skb_queue_head_init(&chan->tx_q); + skb_queue_head_init(&chan->srej_q); mutex_init(&chan->lock); /* Set default lock nesting level */ -- 2.30.2