lkml.org 
[lkml]   [2021]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.10 127/137] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response
    Date
    From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

    [ Upstream commit de895b43932cb47e69480540be7eca289af24f23 ]

    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>
    ---
    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 17520133093a..0ddbc415ce15 100644
    --- a/net/bluetooth/l2cap_core.c
    +++ b/net/bluetooth/l2cap_core.c
    @@ -6055,7 +6055,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;

    @@ -6074,7 +6074,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.30.2
    \
     
     \ /
      Last update: 2021-07-06 14:11    [W:4.973 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site