linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: initialize skb_queue_head at l2cap_chan_create()
@ 2021-03-21 22:52 Tetsuo Handa
  2021-03-22  0:24 ` bluez.test.bot
  2021-03-22 16:05 ` [PATCH] " Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Tetsuo Handa @ 2021-03-21 22:52 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: linux-bluetooth, netdev, Tetsuo Handa

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>
---
 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 72c2f5226d67..c2b5a429ed42 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -451,6 +451,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.18.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: initialize skb_queue_head at l2cap_chan_create()
  2021-03-21 22:52 [PATCH] Bluetooth: initialize skb_queue_head at l2cap_chan_create() Tetsuo Handa
@ 2021-03-22  0:24 ` bluez.test.bot
  2021-03-22 16:05 ` [PATCH] " Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2021-03-22  0:24 UTC (permalink / raw)
  To: linux-bluetooth, penguin-kernel

[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=452389

---Test result---

##############################
Test: CheckPatch - FAIL
Bluetooth: initialize skb_queue_head at l2cap_chan_create()
WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#16: 
Reported-and-tested-by: syzbot <syzbot+fadfba6a911f6bf71842@syzkaller.appspotmail.com>

total: 0 errors, 1 warnings, 0 checks, 8 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

"[PATCH] Bluetooth: initialize skb_queue_head at l2cap_chan_create()" has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: CheckGitLint - FAIL
Bluetooth: initialize skb_queue_head at l2cap_chan_create()
13: B1 Line exceeds max length (86>80): "Reported-and-tested-by: syzbot <syzbot+fadfba6a911f6bf71842@syzkaller.appspotmail.com>"


##############################
Test: CheckBuildK - PASS


##############################
Test: CheckTestRunner: Setup - PASS


##############################
Test: CheckTestRunner: l2cap-tester - PASS
Total: 40, Passed: 34 (85.0%), Failed: 0, Not Run: 6

##############################
Test: CheckTestRunner: bnep-tester - PASS
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: mgmt-tester - PASS
Total: 416, Passed: 402 (96.6%), Failed: 0, Not Run: 14

##############################
Test: CheckTestRunner: rfcomm-tester - PASS
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: sco-tester - PASS
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: smp-tester - PASS
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: userchan-tester - PASS
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 43342 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3532 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 546680 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11653 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 9888 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11799 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 5430 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: initialize skb_queue_head at l2cap_chan_create()
  2021-03-21 22:52 [PATCH] Bluetooth: initialize skb_queue_head at l2cap_chan_create() Tetsuo Handa
  2021-03-22  0:24 ` bluez.test.bot
@ 2021-03-22 16:05 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2021-03-22 16:05 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: Johan Hedberg, Luiz Augusto von Dentz, linux-bluetooth, netdev

Hi Tetsuo,

> 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>
> ---
> net/bluetooth/l2cap_core.c | 2 ++
> 1 file changed, 2 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-22 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-21 22:52 [PATCH] Bluetooth: initialize skb_queue_head at l2cap_chan_create() Tetsuo Handa
2021-03-22  0:24 ` bluez.test.bot
2021-03-22 16:05 ` [PATCH] " Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).