<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/usb/gadget/function, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Merge tag 'usb-7.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb</title>
<updated>2026-11-16T15:55:02+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-11-16T15:55:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f11fe7603df07fbb9fa02b0d385c1696c87a6dab'/>
<id>f11fe7603df07fbb9fa02b0d385c1696c87a6dab</id>
<content type='text'>
Pull USB/Thunderbolt fixes from Greg KH:
 "Here are a bunch of USB (and one Thunderbolt) fixes. Sorry for the
  delay on them, been stuck in travel hell for a bit and these have been
  sitting all ready to be merged for too long. Included in here are:

   - lots of tiny USB fixes found by anthropic scans

   - usb-serial bugfixes

   - xhci driver fixes for issues regressions by many people

   - dwc3 driver fixes for reported problems

   - some usb gadget driver fixes for reported problems

   - other minor USB driver fixes

  Most of these have been in linux-next for weeks with no reported
  issues, the others have been in linux-next for 11 days, also with no
  reported problems"

* tag 'usb-7.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (45 commits)
  usb: xhci: fix 'num_active_eps' accounting on allocation failure
  usb: xhci: clear stale bandwidth data after hibernation
  usb: pci-quirks: always assert xHCI OS ownership
  usb: xhci: disable the correct slot on alloc_dev failure
  xhci: keep port link_inactive and connected flags in sync when polled
  usb: typec: ucsi: retry init only while the PPM is not ready
  xhci: give back TDs and clean up ep0 after disconnect
  USB: serial: garmin_gps: fix deadlock on reset request
  USB: serial: oti6858: fix the teardown order in close
  USB: serial: io_edgeport: serialise MCR accesses
  USB: serial: io_edgeport: fix potential use-after-free on disconnect
  USB: serial: io_edgeport: fix potential fifo corruption
  USB: serial: io_edgeport: move initial termios update to open()
  USB: serial: io_edgeport: fix potential NULL-deref at open
  USB: serial: io_edgeport: fix potential close() use-after-free
  USB: serial: io_edgeport: fix NULL-deref on early status
  USB: serial: upd78f0730: fix NULL-deref on hangup
  USB: serial: sierra: validate URB length in instat callback
  USB: serial: garmin_gps: validate packet data length in nat_receive()
  usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull USB/Thunderbolt fixes from Greg KH:
 "Here are a bunch of USB (and one Thunderbolt) fixes. Sorry for the
  delay on them, been stuck in travel hell for a bit and these have been
  sitting all ready to be merged for too long. Included in here are:

   - lots of tiny USB fixes found by anthropic scans

   - usb-serial bugfixes

   - xhci driver fixes for issues regressions by many people

   - dwc3 driver fixes for reported problems

   - some usb gadget driver fixes for reported problems

   - other minor USB driver fixes

  Most of these have been in linux-next for weeks with no reported
  issues, the others have been in linux-next for 11 days, also with no
  reported problems"

* tag 'usb-7.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (45 commits)
  usb: xhci: fix 'num_active_eps' accounting on allocation failure
  usb: xhci: clear stale bandwidth data after hibernation
  usb: pci-quirks: always assert xHCI OS ownership
  usb: xhci: disable the correct slot on alloc_dev failure
  xhci: keep port link_inactive and connected flags in sync when polled
  usb: typec: ucsi: retry init only while the PPM is not ready
  xhci: give back TDs and clean up ep0 after disconnect
  USB: serial: garmin_gps: fix deadlock on reset request
  USB: serial: oti6858: fix the teardown order in close
  USB: serial: io_edgeport: serialise MCR accesses
  USB: serial: io_edgeport: fix potential use-after-free on disconnect
  USB: serial: io_edgeport: fix potential fifo corruption
  USB: serial: io_edgeport: move initial termios update to open()
  USB: serial: io_edgeport: fix potential NULL-deref at open
  USB: serial: io_edgeport: fix potential close() use-after-free
  USB: serial: io_edgeport: fix NULL-deref on early status
  USB: serial: upd78f0730: fix NULL-deref on hangup
  USB: serial: sierra: validate URB length in instat callback
  USB: serial: garmin_gps: validate packet data length in nat_receive()
  usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>treewide: refresh kmalloc_obj() conversions</title>
<updated>2026-11-06T05:55:37+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees+treewide@kernel.org</email>
</author>
<published>2026-10-29T06:08:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0af298e62e5cff4ebf9bec47b8711177a7e2f115'/>
<id>0af298e62e5cff4ebf9bec47b8711177a7e2f115</id>
<content type='text'>
Refresh the tree with run of the existing Coccinelle rules in
scripts/coccinelle/api/kmalloc_objs.cocci, now that they also convert
arrays of multi-byte integers.

The conversions break down as:

	435	kzalloc_objs()
	169	kmalloc_objs()
	 52	kvzalloc_objs()
	 47	kzalloc_obj()
	 42	kvmalloc_objs()
	  8	kmalloc_obj()
	  2	kzalloc_flex()
	  2	kvmalloc_flex()

and 37 existing kmalloc_obj() family calls drop a redundant GFP_KERNEL.

Build tested with allmodconfig on x86_64 with GCC 16.2.0, and, together
with the devm_kmalloc_obj() conversion that follows, on x86_64, arm64,
i386, arm, riscv, s390, m68k, mips, parisc, sparc, loongarch, arc,
xtensa, and openrisc with GCC 16.2.0 with no new warnings.

Signed-off-by: Kees Cook &lt;kees+treewide@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refresh the tree with run of the existing Coccinelle rules in
scripts/coccinelle/api/kmalloc_objs.cocci, now that they also convert
arrays of multi-byte integers.

The conversions break down as:

	435	kzalloc_objs()
	169	kmalloc_objs()
	 52	kvzalloc_objs()
	 47	kzalloc_obj()
	 42	kvmalloc_objs()
	  8	kmalloc_obj()
	  2	kzalloc_flex()
	  2	kvmalloc_flex()

and 37 existing kmalloc_obj() family calls drop a redundant GFP_KERNEL.

Build tested with allmodconfig on x86_64 with GCC 16.2.0, and, together
with the devm_kmalloc_obj() conversion that follows, on x86_64, arm64,
i386, arm, riscv, s390, m68k, mips, parisc, sparc, loongarch, arc,
xtensa, and openrisc with GCC 16.2.0 with no new warnings.

Signed-off-by: Kees Cook &lt;kees+treewide@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty</title>
<updated>2026-10-29T10:12:21+00:00</updated>
<author>
<name>Cosmin Tanislav</name>
<email>cosmin-gabriel.tanislav.xa@renesas.com</email>
</author>
<published>2026-08-17T19:26:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=78585f90feb3bbaf3b1c642294c8c47e451dc3cf'/>
<id>78585f90feb3bbaf3b1c642294c8c47e451dc3cf</id>
<content type='text'>
ncm_wrap_ntb() aggregates datagrams into a pending NTB, which is sent
either when it becomes full, or after 300us since the NTB was started,
using ndo_start_xmit() (eth_start_xmit()).

ndo_start_xmit() returns NETDEV_TX_BUSY when the TX freelist is empty.

For regular packets this is fine since the networking core will requeue
them, but for timer-flushed packets there is no logic to handle this
situation, and HRTIMER_NORESTART is returned from ncm_tx_timeout()
without checking eth_start_xmit()'s return value.

Under sustained TX saturation the request freelist is empty most of the
time. Since the timer is never restarted, small packets keep getting
accumulated into the NTB, until either TX_MAX_NUM_DPE packets are stored
or NTB_DEFAULT_IN_SIZE is reached, which is an unknown amount of time.

Check the return value of ndo_start_xmit() and restart the timer after
another 300us.

Cc: stable &lt;stable@kernel.org&gt;
Fixes: 6d3865f9d41f ("usb: gadget: NCM: Add transmit multi-frame.")
Signed-off-by: Cosmin Tanislav &lt;cosmin-gabriel.tanislav.xa@renesas.com&gt;
Tested-by: Vladyslav Tymoshchuk &lt;tvlad744@gmail.com&gt;
Tested-by: Leonardo Costa &lt;leonardo.costa@toradex.com&gt;
Reported-by: Hiago De Franco &lt;hiago.franco@toradex.com&gt;
Closes: https://lore.kernel.org/all/20231204183751.64202-1-hiagofranco@gmail.com/
Link: https://patch.msgid.link/20260817192638.437798-1-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ncm_wrap_ntb() aggregates datagrams into a pending NTB, which is sent
either when it becomes full, or after 300us since the NTB was started,
using ndo_start_xmit() (eth_start_xmit()).

ndo_start_xmit() returns NETDEV_TX_BUSY when the TX freelist is empty.

For regular packets this is fine since the networking core will requeue
them, but for timer-flushed packets there is no logic to handle this
situation, and HRTIMER_NORESTART is returned from ncm_tx_timeout()
without checking eth_start_xmit()'s return value.

Under sustained TX saturation the request freelist is empty most of the
time. Since the timer is never restarted, small packets keep getting
accumulated into the NTB, until either TX_MAX_NUM_DPE packets are stored
or NTB_DEFAULT_IN_SIZE is reached, which is an unknown amount of time.

Check the return value of ndo_start_xmit() and restart the timer after
another 300us.

Cc: stable &lt;stable@kernel.org&gt;
Fixes: 6d3865f9d41f ("usb: gadget: NCM: Add transmit multi-frame.")
Signed-off-by: Cosmin Tanislav &lt;cosmin-gabriel.tanislav.xa@renesas.com&gt;
Tested-by: Vladyslav Tymoshchuk &lt;tvlad744@gmail.com&gt;
Tested-by: Leonardo Costa &lt;leonardo.costa@toradex.com&gt;
Reported-by: Hiago De Franco &lt;hiago.franco@toradex.com&gt;
Closes: https://lore.kernel.org/all/20231204183751.64202-1-hiagofranco@gmail.com/
Link: https://patch.msgid.link/20260817192638.437798-1-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: gadget: f_midi: fix UAF race during IN request handling</title>
<updated>2026-10-29T10:12:06+00:00</updated>
<author>
<name>Sonali Pradhan</name>
<email>sonalipradhan@google.com</email>
</author>
<published>2026-10-28T07:48:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=78a8d6537f1de34770e460edee360b556ef40427'/>
<id>78a8d6537f1de34770e460edee360b556ef40427</id>
<content type='text'>
f_midi_disable() drains and frees pre-allocated IN requests from
in_req_fifo without holding midi-&gt;transmit_lock. If f_midi_transmit()
runs concurrently on the workqueue, f_midi_do_transmit() can peek a
request from in_req_fifo and write into its buffer while
f_midi_disable() frees it, leading to a use-after-free.

Additionally, when usb_ep_queue() fails in f_midi_do_transmit() (such
as with -ESHUTDOWN when the endpoint is disabled concurrently), it
resets req-&gt;length = 0 and returns active instead of the error code,
causing the do-while loop in f_midi_transmit() to keep spinning under
midi-&gt;transmit_lock until the substream is drained.

Fix this by acquiring midi-&gt;transmit_lock in f_midi_disable() while
releasing IN requests from in_req_fifo, and returning the error code
from f_midi_do_transmit() when usb_ep_queue() fails so f_midi_transmit()
aborts immediately and drops active substreams.

Fixes: e1e3d7ec5da3 ("usb: gadget: f_midi: pre-allocate IN requests")
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Sonali Pradhan &lt;sonalipradhan@google.com&gt;
Link: https://patch.msgid.link/20261028074821.579450-1-sonalipradhan@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
f_midi_disable() drains and frees pre-allocated IN requests from
in_req_fifo without holding midi-&gt;transmit_lock. If f_midi_transmit()
runs concurrently on the workqueue, f_midi_do_transmit() can peek a
request from in_req_fifo and write into its buffer while
f_midi_disable() frees it, leading to a use-after-free.

Additionally, when usb_ep_queue() fails in f_midi_do_transmit() (such
as with -ESHUTDOWN when the endpoint is disabled concurrently), it
resets req-&gt;length = 0 and returns active instead of the error code,
causing the do-while loop in f_midi_transmit() to keep spinning under
midi-&gt;transmit_lock until the substream is drained.

Fix this by acquiring midi-&gt;transmit_lock in f_midi_disable() while
releasing IN requests from in_req_fifo, and returning the error code
from f_midi_do_transmit() when usb_ep_queue() fails so f_midi_transmit()
aborts immediately and drops active substreams.

Fixes: e1e3d7ec5da3 ("usb: gadget: f_midi: pre-allocate IN requests")
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Sonali Pradhan &lt;sonalipradhan@google.com&gt;
Link: https://patch.msgid.link/20261028074821.579450-1-sonalipradhan@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: gadget: u_serial: pin ports while TTYs are installed</title>
<updated>2026-10-29T10:11:45+00:00</updated>
<author>
<name>Krystian Kaniewski</name>
<email>krystianmkaniewski@gmail.com</email>
</author>
<published>2026-10-22T09:13:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1981b53c2b52a00f0f4b9eb87183c9aedc8dac5d'/>
<id>1981b53c2b52a00f0f4b9eb87183c9aedc8dac5d</id>
<content type='text'>
A slab-use-after-free can occur when gserial_free_line() frees struct
gs_port while it is still reachable through an installed TTY. The
port-&gt;port.count value tracks successful opens, but it is zero before
gs_open() and again after gs_close(), before TTY cleanup has finished.
Teardown can therefore free gs_port while tty_init_dev() or release_tty()
still accesses its tty_port.

Manage gs_port lifetime with tty_port references. Take a reference in
gs_install(), drop it in gs_cleanup(), and move the final free to
gs_port_destruct(). Unregister the TTY device before dropping the owner
reference.

Keep each minor reserved until the old port is destroyed so an installed
TTY for one generation cannot overlap a replacement at the same minor.
Publish the new port before device registration so the cdev and add uevent
never expose a TTY before gs_install() can pin it. Since commit
8df07fe93573 ("tty: fix saved termios reset race"), u_serial registration
no longer frees saved termios. On registration failure, unpublish the port
before dropping its owner reference.

Check in gs_open() that the installed port is still the published
generation. Track failures after a successful install so close callbacks
issued by the TTY core do not decrement port-&gt;port.count for opens that
never incremented it.

Fixes: 19b10a8828a6 ("usb: gadget: allocate &amp; giveback serial ports instead hard code them")
Assisted-by: Gemini:gemini-3.8-flash syzbot
Reported-by: syzbot+fe63e4d633540f230624@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=fe63e4d633540f230624
Link: https://syzkaller.appspot.com/ai_job?id=ec789387-2e7b-4a8f-a7a1-a47bf7fa57f5
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Krystian Kaniewski &lt;krystianmkaniewski@gmail.com&gt;
Tested-by: syzbot@syzkaller.appspotmail.com
Tested-by: Mehmet Fide &lt;mehmet.fide@screeningeagle.com&gt;
Reported-by: syzbot+bca09f5d8b843bbf7571@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=bca09f5d8b843bbf7571
Link: https://patch.msgid.link/20261022091359.1187468-1-krystianmkaniewski@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A slab-use-after-free can occur when gserial_free_line() frees struct
gs_port while it is still reachable through an installed TTY. The
port-&gt;port.count value tracks successful opens, but it is zero before
gs_open() and again after gs_close(), before TTY cleanup has finished.
Teardown can therefore free gs_port while tty_init_dev() or release_tty()
still accesses its tty_port.

Manage gs_port lifetime with tty_port references. Take a reference in
gs_install(), drop it in gs_cleanup(), and move the final free to
gs_port_destruct(). Unregister the TTY device before dropping the owner
reference.

Keep each minor reserved until the old port is destroyed so an installed
TTY for one generation cannot overlap a replacement at the same minor.
Publish the new port before device registration so the cdev and add uevent
never expose a TTY before gs_install() can pin it. Since commit
8df07fe93573 ("tty: fix saved termios reset race"), u_serial registration
no longer frees saved termios. On registration failure, unpublish the port
before dropping its owner reference.

Check in gs_open() that the installed port is still the published
generation. Track failures after a successful install so close callbacks
issued by the TTY core do not decrement port-&gt;port.count for opens that
never incremented it.

Fixes: 19b10a8828a6 ("usb: gadget: allocate &amp; giveback serial ports instead hard code them")
Assisted-by: Gemini:gemini-3.8-flash syzbot
Reported-by: syzbot+fe63e4d633540f230624@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=fe63e4d633540f230624
Link: https://syzkaller.appspot.com/ai_job?id=ec789387-2e7b-4a8f-a7a1-a47bf7fa57f5
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Krystian Kaniewski &lt;krystianmkaniewski@gmail.com&gt;
Tested-by: syzbot@syzkaller.appspotmail.com
Tested-by: Mehmet Fide &lt;mehmet.fide@screeningeagle.com&gt;
Reported-by: syzbot+bca09f5d8b843bbf7571@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=bca09f5d8b843bbf7571
Link: https://patch.msgid.link/20261022091359.1187468-1-krystianmkaniewski@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF</title>
<updated>2026-10-29T10:07:29+00:00</updated>
<author>
<name>Yu Zhang</name>
<email>yuz08559@gmail.com</email>
</author>
<published>2026-10-20T02:30:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=450fa94d7ae9fc91c3df525f5d1322bf8fecf7b2'/>
<id>450fa94d7ae9fc91c3df525f5d1322bf8fecf7b2</id>
<content type='text'>
fsg_store_nofua() syncs the LUN's backing file when switching from async
to sync mode:

	if (!nofua &amp;&amp; curlun-&gt;nofua)
		fsg_lun_fsync_sub(curlun);

fsg_lun_fsync_sub() dereferences curlun-&gt;filp (vfs_fsync(filp)). Unlike
every other store that touches the backing file -- fsg_store_ro() and
fsg_store_cdrom() (down_read), fsg_store_file() (down_write) --
fsg_store_nofua() holds no filesem while doing so.

A concurrent close of the backing file runs under down_write(filesem) and
does fput(curlun-&gt;filp) in fsg_lun_close() (fsg_store_file() with an empty
path, the SCSI START_STOP eject in do_start_stop(), or forced_eject), so
it can free the file while fsg_store_nofua() is dereferencing it:

	BUG: KASAN: slab-use-after-free in vfs_fsync+0x20/0xe0
	 vfs_fsync+0x20/0xe0
	 fsg_lun_fsync_sub+0xa0/0xd0
	 fsg_store_nofua+0x138/0x160
	 configfs_write_iter+0x1a7/0x250
	 vfs_write+0x5df/0x940
	Allocated by task 3459:
	 fsg_store_file+0x150/0x1f0
	 configfs_write_iter+0x1a7/0x250
	Freed by task 3459:
	 __fput+0x456/0x6c0
	 __fput_deferred+0x10d/0x330
	 fsg_store_file+0x9e/0x1f0
	 configfs_write_iter+0x1a7/0x250

Hold filesem for read around the fsync in fsg_store_nofua() so the backing
file cannot be closed underneath it. The lock is only needed when the
fsync actually runs, so it is taken only in that branch.

Reproduced on a mass_storage gadget over dummy_hcd by writing lun.N/nofua
(1 then 0) from one task while another task rewrites and clears lun.N/file.

Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Yu Zhang &lt;yuz08559@gmail.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Link: https://patch.msgid.link/20261020023050.87701-1-yuz08559@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fsg_store_nofua() syncs the LUN's backing file when switching from async
to sync mode:

	if (!nofua &amp;&amp; curlun-&gt;nofua)
		fsg_lun_fsync_sub(curlun);

fsg_lun_fsync_sub() dereferences curlun-&gt;filp (vfs_fsync(filp)). Unlike
every other store that touches the backing file -- fsg_store_ro() and
fsg_store_cdrom() (down_read), fsg_store_file() (down_write) --
fsg_store_nofua() holds no filesem while doing so.

A concurrent close of the backing file runs under down_write(filesem) and
does fput(curlun-&gt;filp) in fsg_lun_close() (fsg_store_file() with an empty
path, the SCSI START_STOP eject in do_start_stop(), or forced_eject), so
it can free the file while fsg_store_nofua() is dereferencing it:

	BUG: KASAN: slab-use-after-free in vfs_fsync+0x20/0xe0
	 vfs_fsync+0x20/0xe0
	 fsg_lun_fsync_sub+0xa0/0xd0
	 fsg_store_nofua+0x138/0x160
	 configfs_write_iter+0x1a7/0x250
	 vfs_write+0x5df/0x940
	Allocated by task 3459:
	 fsg_store_file+0x150/0x1f0
	 configfs_write_iter+0x1a7/0x250
	Freed by task 3459:
	 __fput+0x456/0x6c0
	 __fput_deferred+0x10d/0x330
	 fsg_store_file+0x9e/0x1f0
	 configfs_write_iter+0x1a7/0x250

Hold filesem for read around the fsync in fsg_store_nofua() so the backing
file cannot be closed underneath it. The lock is only needed when the
fsync actually runs, so it is taken only in that branch.

Reproduced on a mass_storage gadget over dummy_hcd by writing lun.N/nofua
(1 then 0) from one task while another task rewrites and clears lun.N/file.

Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Yu Zhang &lt;yuz08559@gmail.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Link: https://patch.msgid.link/20261020023050.87701-1-yuz08559@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: gadget: u_serial: fix NULL deref in gs_close() after failed open</title>
<updated>2026-10-29T10:05:59+00:00</updated>
<author>
<name>Brian Ellis</name>
<email>brianellis@gotenna.com</email>
</author>
<published>2026-10-13T20:57:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ea6cf69ad03c8d85138830c0d2c3b946b5ae231d'/>
<id>ea6cf69ad03c8d85138830c0d2c3b946b5ae231d</id>
<content type='text'>
gs_close() opens with

	struct gs_port *port = tty-&gt;driver_data;
	...
	spin_lock_irq(&amp;port-&gt;port_lock);

and never checks port.  gs_open() assigns tty-&gt;driver_data only on the
port.count 0 -&gt; 1 edge, so any failure earlier in gs_open() leaves it NULL,
and tty_open() calls tty_release(), and hence -&gt;close(), when -&gt;open()
fails.

syzbot hit exactly this on arm64.  Fault injection failed the kfifo_alloc()
of the write buffer in gs_open():

   __kfifo_alloc_node+0x10c/0x208 lib/kfifo.c:44
   gs_open+0x144/0x514 drivers/usb/gadget/function/u_serial.c:636
   tty_open+0x404/0x89c drivers/tty/tty_io.c:2137

and the tty core's close of the failed open then took port_lock through
the NULL port:

  BUG: unable to handle kernel paging request in gs_close
  KASAN: null-ptr-deref in range [0x00000000000003a0-0x00000000000003a7]
  Call trace:
   spin_lock_irq include/linux/spinlock.h:372 [inline]
   gs_close+0xac/0x65c drivers/usb/gadget/function/u_serial.c:698
   tty_release+0x2c4/0xffc drivers/tty/tty_io.c:1745
   tty_open+0x46c/0x89c drivers/tty/tty_io.c:2146

Return early instead.  There is nothing to release when the open never got
far enough to claim the port.

Unlike the check reverted by commit f6c7bc4a6823 ("Revert "usb: gadget:
u_serial: Add null pointer check in gs_start_io""), this is not hiding a
race: the tty core calls -&gt;close() for an -&gt;open() that failed by design,
so driver_data is legitimately unset on that path.

Fixes: c1dca562be8a ("usb gadget: split out serial core")
Reported-by: syzbot+782b2f1063e38ba8fa6e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=782b2f1063e38ba8fa6e
Cc: stable &lt;stable@kernel.org&gt;
Assisted-by: LLM
Signed-off-by: Brian Ellis &lt;brianellis@gotenna.com&gt;
Link: https://patch.msgid.link/20261013-u_serial-gs-close-null-v4-1-9ea038501994@gotenna.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gs_close() opens with

	struct gs_port *port = tty-&gt;driver_data;
	...
	spin_lock_irq(&amp;port-&gt;port_lock);

and never checks port.  gs_open() assigns tty-&gt;driver_data only on the
port.count 0 -&gt; 1 edge, so any failure earlier in gs_open() leaves it NULL,
and tty_open() calls tty_release(), and hence -&gt;close(), when -&gt;open()
fails.

syzbot hit exactly this on arm64.  Fault injection failed the kfifo_alloc()
of the write buffer in gs_open():

   __kfifo_alloc_node+0x10c/0x208 lib/kfifo.c:44
   gs_open+0x144/0x514 drivers/usb/gadget/function/u_serial.c:636
   tty_open+0x404/0x89c drivers/tty/tty_io.c:2137

and the tty core's close of the failed open then took port_lock through
the NULL port:

  BUG: unable to handle kernel paging request in gs_close
  KASAN: null-ptr-deref in range [0x00000000000003a0-0x00000000000003a7]
  Call trace:
   spin_lock_irq include/linux/spinlock.h:372 [inline]
   gs_close+0xac/0x65c drivers/usb/gadget/function/u_serial.c:698
   tty_release+0x2c4/0xffc drivers/tty/tty_io.c:1745
   tty_open+0x46c/0x89c drivers/tty/tty_io.c:2146

Return early instead.  There is nothing to release when the open never got
far enough to claim the port.

Unlike the check reverted by commit f6c7bc4a6823 ("Revert "usb: gadget:
u_serial: Add null pointer check in gs_start_io""), this is not hiding a
race: the tty core calls -&gt;close() for an -&gt;open() that failed by design,
so driver_data is legitimately unset on that path.

Fixes: c1dca562be8a ("usb gadget: split out serial core")
Reported-by: syzbot+782b2f1063e38ba8fa6e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=782b2f1063e38ba8fa6e
Cc: stable &lt;stable@kernel.org&gt;
Assisted-by: LLM
Signed-off-by: Brian Ellis &lt;brianellis@gotenna.com&gt;
Link: https://patch.msgid.link/20261013-u_serial-gs-close-null-v4-1-9ea038501994@gotenna.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'usb-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb</title>
<updated>2026-10-25T01:31:19+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-10-25T01:31:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=168151cdb0f93d26557f9f3c7aae659b8d6b1863'/>
<id>168151cdb0f93d26557f9f3c7aae659b8d6b1863</id>
<content type='text'>
Pull USB / Thunderbolt update from Greg KH:
 "Here is the big set of USB and Thunderbolt changes for 7.4-rc1.
  Included in here are:

   - thunderbolt driver updates and fixes

   - lots of dt schema conversions

   - usb gadget driver fixes (and a new maintainer!)

   - usb core fixups with some interactions with the driver core

   - usb serial updates and fixes for scan-found "issues"

   - xhci driver updates

   - typec driver updates

   - dwc3 driver updates

   - lots of usb gadget driver fixes for syzbot found "problems"

   - lots of other small USB driver fixes for randomly reported problems.

  All of these have been in linux-next with no reported issues"

* tag 'usb-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (158 commits)
  usb: gadget: dummy_hcd: prevent unbind via sysfs
  usb: gadget: dummy_hcd: add tick_us module parameter for timer-rate tuning
  usb: gadget: dummy_hcd: set no_sg_constraint only on the SuperSpeed bus
  usb: gadget: dummy_hcd: fix SuperSpeed ep0 maxpacket
  usb: gadget: fix refcount underflow in gadgetfs_bind() error path
  USB: core: document purpose of interface parent reference
  MAINTAINERS: add Neill Kapron as USB Gadget maintainer
  USB: Documentation: Update description of completion callback context
  USB: serial: mxuport: support RS485 mode configuration
  USB: serial: mxuport: handle SEND_NEXT transmit flow control
  USB: serial: add generic write control callbacks
  USB: serial: mxuport: add MUX50U-based device support
  USB: serial: mxuport: clean up firmware version handling
  USB: serial: mxuport: clean up product ID definitions and device table
  USB: serial: sierra: fix urb leak on write completion
  usb: typec: ucsi_ccg: Add retry mechanism in ccg_read
  usb: host: xhci-tegra: Add Tegra264 XHCI support
  usb: host: xhci-tegra: Skip MBOX MSG_ENABLED on Tegra264
  dt-bindings: usb: Add Tegra264 XUSB host support
  usb: xhci-pci: Add TUSB73x0 definitions
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull USB / Thunderbolt update from Greg KH:
 "Here is the big set of USB and Thunderbolt changes for 7.4-rc1.
  Included in here are:

   - thunderbolt driver updates and fixes

   - lots of dt schema conversions

   - usb gadget driver fixes (and a new maintainer!)

   - usb core fixups with some interactions with the driver core

   - usb serial updates and fixes for scan-found "issues"

   - xhci driver updates

   - typec driver updates

   - dwc3 driver updates

   - lots of usb gadget driver fixes for syzbot found "problems"

   - lots of other small USB driver fixes for randomly reported problems.

  All of these have been in linux-next with no reported issues"

* tag 'usb-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (158 commits)
  usb: gadget: dummy_hcd: prevent unbind via sysfs
  usb: gadget: dummy_hcd: add tick_us module parameter for timer-rate tuning
  usb: gadget: dummy_hcd: set no_sg_constraint only on the SuperSpeed bus
  usb: gadget: dummy_hcd: fix SuperSpeed ep0 maxpacket
  usb: gadget: fix refcount underflow in gadgetfs_bind() error path
  USB: core: document purpose of interface parent reference
  MAINTAINERS: add Neill Kapron as USB Gadget maintainer
  USB: Documentation: Update description of completion callback context
  USB: serial: mxuport: support RS485 mode configuration
  USB: serial: mxuport: handle SEND_NEXT transmit flow control
  USB: serial: add generic write control callbacks
  USB: serial: mxuport: add MUX50U-based device support
  USB: serial: mxuport: clean up firmware version handling
  USB: serial: mxuport: clean up product ID definitions and device table
  USB: serial: sierra: fix urb leak on write completion
  usb: typec: ucsi_ccg: Add retry mechanism in ccg_read
  usb: host: xhci-tegra: Add Tegra264 XHCI support
  usb: host: xhci-tegra: Skip MBOX MSG_ENABLED on Tegra264
  dt-bindings: usb: Add Tegra264 XUSB host support
  usb: xhci-pci: Add TUSB73x0 definitions
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi</title>
<updated>2026-10-25T00:30:22+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-10-25T00:30:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6fba331225f5040e93d0947d1027e9712238291f'/>
<id>6fba331225f5040e93d0947d1027e9712238291f</id>
<content type='text'>
Pull SCSI updates from James Bottomley:
 "Small number of driver updates (mpi3mr, ufs, scsi_debug).

  By far the biggest core change (at 4000+ lines) is the sense code
  rework to make our sense handling follow the 16 bit defines in the
  SCSI standard rather than our split ASC and ASCQ handling which ends
  up being confusing and difficult to grep.

  The changes should all be functionally equivalent and so far the bots
  and AI seem to agree; the code has been incubating in -next since 16
  September with one reported issue fixed.

  The remaining updates are minor"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (114 commits)
  scsi: ufs: rpmb: Fix power-on UNIT ATTENTION retry
  scsi: bfa: Use snprintf() in bfa_fcs_fabric_psymb_init()
  scsi: bfa: Use snprintf() in bfa_fcs_fabric_nsymb_init()
  scsi: MAINTAINERS: Remove Avri Altman as UFS reviewer
  scsi: st: Relock the door after a reset
  scsi: st: Restore the drive buffering mode after reset
  scsi: st: Record the tape position after a successful MTLOAD
  scsi: st: Restore changed drive settings after reset also for MTLOAD and MTRETEN
  scsi: scsi_debug: Validate the access parameters of WRITE ATOMIC (16)
  scsi: scsi_debug: Map the region written by WRITE ATOMIC (16)
  scsi: scsi_debug: Refuse a short WRITE ATOMIC (16) before writing it
  scsi: scsi_debug: Advance the write pointer over the data written
  scsi: scsi_debug: Do not write a partial physical block to a zoned device
  scsi: scsi_debug: Enforce physical block alignment of zoned writes
  scsi: scsi_debug: Report the residual of a write
  scsi: scsi_debug: Avoid 32-bit overflow in WRITE SCATTERED offsets
  scsi: scsi_debug: Evaluate scsi_debug_lbp() only once
  scsi: scsi_debug: Take the zone metadata lock before the data lock
  scsi: scsi_debug: Refuse a negative physblk_exp
  scsi: scsi_debug: Make atomic writes and ZBC emulation mutually exclusive
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull SCSI updates from James Bottomley:
 "Small number of driver updates (mpi3mr, ufs, scsi_debug).

  By far the biggest core change (at 4000+ lines) is the sense code
  rework to make our sense handling follow the 16 bit defines in the
  SCSI standard rather than our split ASC and ASCQ handling which ends
  up being confusing and difficult to grep.

  The changes should all be functionally equivalent and so far the bots
  and AI seem to agree; the code has been incubating in -next since 16
  September with one reported issue fixed.

  The remaining updates are minor"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (114 commits)
  scsi: ufs: rpmb: Fix power-on UNIT ATTENTION retry
  scsi: bfa: Use snprintf() in bfa_fcs_fabric_psymb_init()
  scsi: bfa: Use snprintf() in bfa_fcs_fabric_nsymb_init()
  scsi: MAINTAINERS: Remove Avri Altman as UFS reviewer
  scsi: st: Relock the door after a reset
  scsi: st: Restore the drive buffering mode after reset
  scsi: st: Record the tape position after a successful MTLOAD
  scsi: st: Restore changed drive settings after reset also for MTLOAD and MTRETEN
  scsi: scsi_debug: Validate the access parameters of WRITE ATOMIC (16)
  scsi: scsi_debug: Map the region written by WRITE ATOMIC (16)
  scsi: scsi_debug: Refuse a short WRITE ATOMIC (16) before writing it
  scsi: scsi_debug: Advance the write pointer over the data written
  scsi: scsi_debug: Do not write a partial physical block to a zoned device
  scsi: scsi_debug: Enforce physical block alignment of zoned writes
  scsi: scsi_debug: Report the residual of a write
  scsi: scsi_debug: Avoid 32-bit overflow in WRITE SCATTERED offsets
  scsi: scsi_debug: Evaluate scsi_debug_lbp() only once
  scsi: scsi_debug: Take the zone metadata lock before the data lock
  scsi: scsi_debug: Refuse a negative physblk_exp
  scsi: scsi_debug: Make atomic writes and ZBC emulation mutually exclusive
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge 7.3-rc6 into usb-next</title>
<updated>2026-10-05T05:51:27+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2026-10-05T05:51:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5926a7da87895b1e1e1b3789ef364a11cc54d210'/>
<id>5926a7da87895b1e1e1b3789ef364a11cc54d210</id>
<content type='text'>
We need the usb/thunderbolt fixes in here to work off of.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We need the usb/thunderbolt fixes in here to work off of.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
