]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
usb: gadget: f_uac1_legacy: validate control request size
authorTaegu Ha <hataegu0826@gmail.com>
Wed, 1 Apr 2026 19:13:11 +0000 (04:13 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2026 07:37:17 +0000 (09:37 +0200)
commit6e0e34d85cd46ceb37d16054e97a373a32770f6c
treefb4ad322c9e8172147256da111cb9bb1c9029e14
parent01af542392b5d41fd659d487015a71f627accce3
usb: gadget: f_uac1_legacy: validate control request size

f_audio_complete() copies req->length bytes into a 4-byte stack
variable:

  u32 data = 0;
  memcpy(&data, req->buf, req->length);

req->length is derived from the host-controlled USB request path,
which can lead to a stack out-of-bounds write.

Validate req->actual against the expected payload size for the
supported control selectors and decode only the expected amount
of data.

This avoids copying a host-influenced length into a fixed-size
stack object.

Signed-off-by: Taegu Ha <hataegu0826@gmail.com>
Cc: stable <stable@kernel.org>
Link: https://patch.msgid.link/20260401191311.3604898-1-hataegu0826@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_uac1_legacy.c