All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails
@ 2021-05-19 20:41 Luiz Augusto von Dentz
  2021-05-19 20:41 ` [PATCH 2/2] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2021-05-19 20:41 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The use of l2cap_chan_del is not safe under a loop using
list_for_each_entry.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/l2cap_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 7d975cf98c20..f3b70fa348ab 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6248,7 +6248,7 @@ static inline int l2cap_ecred_reconf_rsp(struct l2cap_conn *conn,
 					 struct l2cap_cmd_hdr *cmd, u16 cmd_len,
 					 u8 *data)
 {
-	struct l2cap_chan *chan;
+	struct l2cap_chan *chan, *tmp;
 	struct l2cap_ecred_conn_rsp *rsp = (void *) data;
 	u16 result;
 
@@ -6262,7 +6262,7 @@ static inline int l2cap_ecred_reconf_rsp(struct l2cap_conn *conn,
 	if (!result)
 		return 0;
 
-	list_for_each_entry(chan, &conn->chan_l, list) {
+	list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
 		if (chan->ident != cmd->ident)
 			continue;
 
-- 
2.31.1


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

* [PATCH 2/2] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response
  2021-05-19 20:41 [PATCH 1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails Luiz Augusto von Dentz
@ 2021-05-19 20:41 ` Luiz Augusto von Dentz
  2021-05-20 15:19   ` Marcel Holtmann
  2021-05-19 21:09 ` [1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails bluez.test.bot
  2021-05-20 15:19 ` [PATCH 1/2] " Marcel Holtmann
  2 siblings, 1 reply; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2021-05-19 20:41 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The use of l2cap_chan_del is not safe under a loop using
list_for_each_entry.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/l2cap_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index f3b70fa348ab..9ebb85df4db4 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6066,7 +6066,7 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
 	struct l2cap_ecred_conn_rsp *rsp = (void *) data;
 	struct hci_conn *hcon = conn->hcon;
 	u16 mtu, mps, credits, result;
-	struct l2cap_chan *chan;
+	struct l2cap_chan *chan, *tmp;
 	int err = 0, sec_level;
 	int i = 0;
 
@@ -6085,7 +6085,7 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
 
 	cmd_len -= sizeof(*rsp);
 
-	list_for_each_entry(chan, &conn->chan_l, list) {
+	list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
 		u16 dcid;
 
 		if (chan->ident != cmd->ident ||
-- 
2.31.1


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

* RE: [1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails
  2021-05-19 20:41 [PATCH 1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails Luiz Augusto von Dentz
  2021-05-19 20:41 ` [PATCH 2/2] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response Luiz Augusto von Dentz
@ 2021-05-19 21:09 ` bluez.test.bot
  2021-05-20 15:19 ` [PATCH 1/2] " Marcel Holtmann
  2 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2021-05-19 21:09 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 2630 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=485329

---Test result---

Test Summary:
CheckPatch                    PASS      1.40 seconds
GitLint                       PASS      0.33 seconds
BuildKernel                   PASS      569.82 seconds
TestRunner: Setup             PASS      380.04 seconds
TestRunner: l2cap-tester      PASS      2.79 seconds
TestRunner: bnep-tester       PASS      1.98 seconds
TestRunner: mgmt-tester       PASS      27.09 seconds
TestRunner: rfcomm-tester     PASS      2.17 seconds
TestRunner: sco-tester        PASS      2.05 seconds
TestRunner: smp-tester        PASS      2.22 seconds
TestRunner: userchan-tester   PASS      2.00 seconds

Details
##############################
Test: CheckPatch - PASS - 1.40 seconds
Run checkpatch.pl script with rule in .checkpatch.conf


##############################
Test: GitLint - PASS - 0.33 seconds
Run gitlint with rule in .gitlint


##############################
Test: BuildKernel - PASS - 569.82 seconds
Build Kernel with minimal configuration supports Bluetooth


##############################
Test: TestRunner: Setup - PASS - 380.04 seconds
Setup environment for running Test Runner


##############################
Test: TestRunner: l2cap-tester - PASS - 2.79 seconds
Run test-runner with l2cap-tester
Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: bnep-tester - PASS - 1.98 seconds
Run test-runner with bnep-tester
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: mgmt-tester - PASS - 27.09 seconds
Run test-runner with mgmt-tester
Total: 416, Passed: 403 (96.9%), Failed: 0, Not Run: 13

##############################
Test: TestRunner: rfcomm-tester - PASS - 2.17 seconds
Run test-runner with rfcomm-tester
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: sco-tester - PASS - 2.05 seconds
Run test-runner with sco-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: smp-tester - PASS - 2.22 seconds
Run test-runner with smp-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: userchan-tester - PASS - 2.00 seconds
Run test-runner with userchan-tester
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth


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

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

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

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

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

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

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

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

* Re: [PATCH 2/2] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response
  2021-05-19 20:41 ` [PATCH 2/2] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response Luiz Augusto von Dentz
@ 2021-05-20 15:19   ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2021-05-20 15:19 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

> The use of l2cap_chan_del is not safe under a loop using
> list_for_each_entry.
> 
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH 1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails
  2021-05-19 20:41 [PATCH 1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails Luiz Augusto von Dentz
  2021-05-19 20:41 ` [PATCH 2/2] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response Luiz Augusto von Dentz
  2021-05-19 21:09 ` [1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails bluez.test.bot
@ 2021-05-20 15:19 ` Marcel Holtmann
  2 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2021-05-20 15:19 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

> The use of l2cap_chan_del is not safe under a loop using
> list_for_each_entry.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2021-05-20 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 20:41 [PATCH 1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails Luiz Augusto von Dentz
2021-05-19 20:41 ` [PATCH 2/2] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response Luiz Augusto von Dentz
2021-05-20 15:19   ` Marcel Holtmann
2021-05-19 21:09 ` [1/2] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails bluez.test.bot
2021-05-20 15:19 ` [PATCH 1/2] " Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.