Skip to content

Commit a019b8d

Browse files
Tetsuo Handagregkh
authored andcommitted
Bluetooth: initialize skb_queue_head at l2cap_chan_create()
[ Upstream commit be85972 ] 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 <syzbot+fadfba6a911f6bf71842@syzkaller.appspotmail.com> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e0dc9e9 commit a019b8d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎net/bluetooth/l2cap_core.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ struct l2cap_chan *l2cap_chan_create(void)
451451
if (!chan)
452452
return NULL;
453453

454+
skb_queue_head_init(&chan->tx_q);
455+
skb_queue_head_init(&chan->srej_q);
454456
mutex_init(&chan->lock);
455457

456458
/* Set default lock nesting level */

0 commit comments

Comments
 (0)