Skip to content

Commit cc49ab2

Browse files
Vudentzgregkh
authored andcommitted
Bluetooth: L2CAP: Fix invalid access on ECRED Connection response
[ Upstream commit de895b4 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 79a3130 commit cc49ab2

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
@@ -6055,7 +6055,7 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
60556055
struct l2cap_ecred_conn_rsp *rsp = (void *) data;
60566056
struct hci_conn *hcon = conn->hcon;
60576057
u16 mtu, mps, credits, result;
6058-
struct l2cap_chan *chan;
6058+
struct l2cap_chan *chan, *tmp;
60596059
int err = 0, sec_level;
60606060
int i = 0;
60616061

@@ -6074,7 +6074,7 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
60746074

60756075
cmd_len -= sizeof(*rsp);
60766076

6077-
list_for_each_entry(chan, &conn->chan_l, list) {
6077+
list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
60786078
u16 dcid;
60796079

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

0 commit comments

Comments
 (0)