Skip to content

Commit

Permalink
Bluetooth: L2CAP: Fix errors during L2CAP_CREDIT_BASED_CONNECTION_REQ…
Browse files Browse the repository at this point in the history
… (0x17)

Fix 2 typos in L2CAP_CREDIT_BASED_CONNECTION_REQ (0x17) handling function, that
cause BlueZ answer with L2CAP_CR_LE_INVALID_PARAMS or L2CAP_CR_LE_INVALID_SCID
error on a correct ECRED connection request.

Enchanced Credit Based Mode support was recently introduced with the commit
15f02b9 ("Bluetooth: L2CAP: Add initial code
for Enhanced Credit Based Mode").

Signed-off-by: Konstantin Forostyan <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
Konstantin Forostyan authored and holtmann committed May 11, 2020
1 parent eaa7b72 commit 69d67b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5927,7 +5927,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
if (!enable_ecred)
return -EINVAL;

if (cmd_len < sizeof(*req) || cmd_len - sizeof(*req) % sizeof(u16)) {
if (cmd_len < sizeof(*req) || (cmd_len - sizeof(*req)) % sizeof(u16)) {
result = L2CAP_CR_LE_INVALID_PARAMS;
goto response;
}
Expand Down Expand Up @@ -5964,7 +5964,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
}

result = L2CAP_CR_LE_SUCCESS;
cmd_len -= sizeof(req);
cmd_len -= sizeof(*req);
num_scid = cmd_len / sizeof(u16);

for (i = 0; i < num_scid; i++) {
Expand Down

0 comments on commit 69d67b4

Please sign in to comment.