Bluetooth: l2cap: Fix double free of 'skb'
Subsystems (2)
PATCH 1/1 Bluetooth: l2cap: Fix double free of 'skb'
Commit ad5747d4eed1 ("Bluetooth: l2cap: Process valid commands in too long frame") from Apr 14, 2025 (linux-next), leads to the following Smatch static checker warning:
net/bluetooth/l2cap_core.c:7613 l2cap_recv_acldata() error: double free of 'skb' (line 7557)
l2cap_recv_frame() consumes the skb.
--- net/bluetooth/l2cap_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +1 -1
@@ -7556,7 +7556,7 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) skb->len = len;l2cap_recv_frame (conn, skb);l2cap_conn_unreliable (conn,ECOMM ); - goto drop; + goto unlock; }/* Append fragment into frame (with header) */
Signature · 1 line
2.43.0
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=953999
---Test result---
Test Summary:
CheckPatch PENDING 0.39 seconds GitLint PENDING 0.28 seconds SubjectPrefix PASS 0.06 seconds BuildKernel PASS 24.36 seconds CheckAllWarning PASS 31.05 seconds CheckSparse PASS 29.79 seconds BuildKernel32 PASS 23.80 seconds TestRunnerSetup PASS 459.58 seconds TestRunner_l2cap-tester PASS 20.95 seconds TestRunner_iso-tester PASS 28.46 seconds TestRunner_bnep-tester PASS 4.73 seconds TestRunner_mgmt-tester FAIL 120.31 seconds TestRunner_rfcomm-tester PASS 19.23 seconds TestRunner_sco-tester PASS 33.25 seconds TestRunner_ioctl-tester PASS 9.35 seconds TestRunner_mesh-tester PASS 35.06 seconds TestRunner_smp-tester PASS 12.09 seconds TestRunner_userchan-tester PASS 4.94 seconds IncrementalBuild PENDING 0.78 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.155 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz
maintainerHi Frédéric,
Quoted 21 lines · Frédéric Danis
Commit
ad5747d4eed1("Bluetooth: l2cap: Process valid commands in too long frame") from Apr 14, 2025 (linux-next), leads to the following Smatch static checker warning:
net/bluetooth/l2cap_core.c:7613l2cap_recv_acldata()
error: double free of 'skb' (line 7557)
l2cap_recv_frame()consumes the skb.Fixes ad5747d4eed1 ("Bluetooth: l2cap: Process valid commands in too long frame")Signed-off-by Frédéric Danis <[email protected]>--- net/bluetooth/l2cap_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/bluetooth/l2cap_core.c +0
-0
net/bluetooth/l2cap_core.c void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) · line 7559
Quoted 5 lines
net/bluetooth/l2cap_core.c +1
-1@@ -7556,7 +7556,7 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) skb->len = len;l2cap_recv_frame (conn, skb);l2cap_conn_unreliable (conn,ECOMM ); - goto drop; + goto unlock;
I went ahead and fixed it up in place since I'm planning to send this to net this week.
Quoted 7 lines
net/bluetooth/l2cap_core.c +0
-1}/* Append fragment into frame (with header) */ --2.43.0
Signature · 1 line
Luiz Augusto von Dentz