Commit 69d67b46 authored by Konstantin Forostyan's avatar Konstantin Forostyan Committed by Marcel Holtmann

Bluetooth: L2CAP: Fix errors during L2CAP_CREDIT_BASED_CONNECTION_REQ (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
15f02b91 ("Bluetooth: L2CAP: Add initial code
for Enhanced Credit Based Mode").
Signed-off-by: default avatarKonstantin Forostyan <konstantin.forostyan@peiker-cee.de>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent eaa7b722
...@@ -5927,7 +5927,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, ...@@ -5927,7 +5927,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
if (!enable_ecred) if (!enable_ecred)
return -EINVAL; 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; result = L2CAP_CR_LE_INVALID_PARAMS;
goto response; goto response;
} }
...@@ -5964,7 +5964,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, ...@@ -5964,7 +5964,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
} }
result = L2CAP_CR_LE_SUCCESS; result = L2CAP_CR_LE_SUCCESS;
cmd_len -= sizeof(req); cmd_len -= sizeof(*req);
num_scid = cmd_len / sizeof(u16); num_scid = cmd_len / sizeof(u16);
for (i = 0; i < num_scid; i++) { for (i = 0; i < num_scid; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment