Skip to content

Commit 7ac2881

Browse files
Dan RosenbergGustavo F. Padovan
authored andcommitted
Bluetooth: Prevent buffer overflow in l2cap config request
A remote user can provide a small value for the command size field in the command header of an l2cap configuration request, resulting in an integer underflow when subtracting the size of the configuration request header. This results in copying a very large amount of data via memcpy() and destroying the kernel heap. Check for underflow. Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com> Cc: stable <stable@kernel.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
1 parent fa7ccfb commit 7ac2881

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/bluetooth/l2cap_core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
23342334

23352335
/* Reject if config buffer is too small. */
23362336
len = cmd_len - sizeof(*req);
2337-
if (chan->conf_len + len > sizeof(chan->conf_req)) {
2337+
if (len < 0 || chan->conf_len + len > sizeof(chan->conf_req)) {
23382338
l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
23392339
l2cap_build_conf_rsp(chan, rsp,
23402340
L2CAP_CONF_REJECT, flags), rsp);

0 commit comments

Comments
 (0)