All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+54927260acba030187a6@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: #syz test
Date: Sat, 01 Aug 2026 09:45:30 -0700	[thread overview]
Message-ID: <6a6e22aa.1aa927e4.17d4bf.0010.GAE@google.com> (raw)
In-Reply-To: <6a6cd832.1aa927e4.17d4bf.0009.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: #syz test
Author: rwarwatkar@gmail.com

From a6329c2864899c7c7ac2c20b9d3e04bf598c6870 Mon Sep 17 00:00:00 2001
From: Rituparna Warwatkar <rwarwatkar@gmail.com>
Date: Sat, 1 Aug 2026 03:31:03 +0000
Subject: [PATCH] usb: gadget: uvc: don't pack struct
 uvcg_extension_unit_descriptor

kmemleak reports the baSourceID and bmControls arrays allocated by the
UVC extension-unit configfs attributes as leaked, e.g.:

  BUG: memory leak
  unreferenced object 0xffff888114fee2c0 (size 8):
    __kmalloc_noprof
    uvcg_extension_ba_source_id_store
    configfs_write_iter
    vfs_write
    ksys_write

The arrays are not actually leaked: they are reachable through
xu->desc.baSourceID / xu->desc.bmControls and are freed when the
extension unit is removed.  The problem is that struct
uvcg_extension_unit_descriptor is marked __packed, so these two heap
pointers are stored at unaligned offsets (22 and 31).  kmemleak only
scans memory on pointer-aligned boundaries, so it never sees the
pointers and reports the arrays as unreferenced.

Unlike the UAPI struct uvc_extension_unit_descriptor, this is a purely
in-memory staging structure: baSourceID and bmControls are pointers,
not inline arrays, and the wire descriptor is assembled field by field
in UVC_COPY_XU_DESCRIPTOR().  Nothing relies on the packed layout, so
the __packed attribute is unnecessary and only serves to misalign the
pointers.

Drop __packed so the pointers are naturally aligned and visible to
kmemleak, silencing the false positive.

Fixes: 0525210c9840 ("usb: gadget: uvc: Allow definition of XUs in configfs")
Reported-by: syzbot+54927260acba030187a6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=54927260acba030187a6
Signed-off-by: Rituparna Warwatkar <rwarwatkar@gmail.com>
---
 drivers/usb/gadget/function/uvc_configfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/uvc_configfs.h b/drivers/usb/gadget/function/uvc_configfs.h
index 9391614135e..5a882afbce4 100644
--- a/drivers/usb/gadget/function/uvc_configfs.h
+++ b/drivers/usb/gadget/function/uvc_configfs.h
@@ -176,7 +176,7 @@ struct uvcg_extension_unit_descriptor {
        u8 bControlSize;
        u8 *bmControls;
        u8 iExtension;
-} __packed;
+};

 struct uvcg_extension {
        struct config_item item;
--
2.47.3


  parent reply	other threads:[~2026-08-01 16:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 17:15 [syzbot] [usb?] memory leak in uvcg_extension_ba_source_id_store syzbot
2026-08-01 16:43 ` Forwarded: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 11028ab62899 syzbot
2026-08-01 16:45 ` syzbot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-07-31  0:11 [syzbot] [usb?] memory leak in f_uac2_opts_c_srate_store syzbot
2026-08-02  0:04 ` Forwarded: #syz test syzbot
2026-05-29 20:01 [syzbot] [netfs?] KASAN: slab-use-after-free Read in netfs_unbuffered_write syzbot
2026-05-30  2:13 ` Forwarded: #syz test syzbot
2026-04-09 18:30 [syzbot] [fuse?] BUG: scheduling while atomic in __synchronize_srcu syzbot
2026-04-13  4:40 ` Forwarded: #syz test syzbot
2026-04-13  4:49 ` syzbot
2026-04-13  4:50 ` syzbot
2026-04-13  4:52 ` syzbot
2026-04-13  5:08 ` syzbot
2026-04-13  6:04 ` syzbot
2026-04-30 16:06 ` syzbot
2026-04-30 17:26 ` syzbot
2026-04-30 17:41 ` syzbot
2026-04-30 18:27 ` syzbot
2026-04-30 18:53 ` syzbot
2025-09-30 20:29 [syzbot] [rdma?] KMSAN: uninit-value in ib_nl_handle_ip_res_resp syzbot
2025-11-06 19:45 ` Forwarded: syz test syzbot
2025-11-07 20:06 ` syzbot
2025-11-07 22:53 ` syzbot
2025-08-27 21:55 [syzbot] [mm?] [usb?] WARNING in __alloc_skb (4) syzbot
2025-09-20 10:59 ` Forwarded: syz test syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a6e22aa.1aa927e4.17d4bf.0010.GAE@google.com \
    --to=syzbot+54927260acba030187a6@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.