Skip to content

Commit de895b4

Browse files
Vudentzholtmann
authored andcommitted
Bluetooth: L2CAP: Fix invalid access on ECRED Connection response
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> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 1fa20d7 commit de895b4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/bluetooth/l2cap_core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6066,7 +6066,7 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
60666066
struct l2cap_ecred_conn_rsp *rsp = (void *) data;
60676067
struct hci_conn *hcon = conn->hcon;
60686068
u16 mtu, mps, credits, result;
6069-
struct l2cap_chan *chan;
6069+
struct l2cap_chan *chan, *tmp;
60706070
int err = 0, sec_level;
60716071
int i = 0;
60726072

@@ -6085,7 +6085,7 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
60856085

60866086
cmd_len -= sizeof(*rsp);
60876087

6088-
list_for_each_entry(chan, &conn->chan_l, list) {
6088+
list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
60896089
u16 dcid;
60906090

60916091
if (chan->ident != cmd->ident ||

0 commit comments

Comments
 (0)