CVE-2026-142987

Not scored yetLast modified Dec 3, 2026

Description

In the Linux kernel, the following vulnerability has been resolved:

usb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF

fsg_store_nofua() syncs the LUN's backing file when switching from async to sync mode:

if (!nofua && curlun->nofua) fsg_lun_fsync_sub(curlun);

fsg_lun_fsync_sub() dereferences curlun->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->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.

Metrics

No CVSS score has been published yet.

Affected software

Source: the vendor's advisory (CNA). NVD analysis pending.

No affected versions have been published.

Timeline

Published
Dec 3, 2026
Last modified
Dec 3, 2026
NVD status
Received

Related CVEs from 2026

CVE-2026-142988In the Linux kernel, the following vulnerability has been resolved: usb: xhci: disable the correct slot on alloc_dev failure xhci_alloc_deCVE-2026-142989In the Linux kernel, the following vulnerability has been resolved: usb: typec: ucsi: Set ucsi->connector before enabling notifications InCVE-2026-142990In the Linux kernel, the following vulnerability has been resolved: usb: usbtest: prevent divide by zero in simple_io() with zero length ACVE-2026-142991In the Linux kernel, the following vulnerability has been resolved: usb: typec: nb7vpq904m: Set client data in probe to avoid crash on remoCVE-2026-142992In the Linux kernel, the following vulnerability has been resolved: USB: serial: oti6858: fix the teardown order in close The driver passeCVE-2026-142993In the Linux kernel, the following vulnerability has been resolved: USB: serial: garmin_gps: fix deadlock on reset request The garmin_gps CVE-2026-142994In the Linux kernel, the following vulnerability has been resolved: thunderbolt: stream: Undo more if the start fails If the receive buffeCVE-2026-142995In the Linux kernel, the following vulnerability has been resolved: serial: samsung: put the previous baud clock s3c24xx_serial_getclk() rCVE-2026-142996In the Linux kernel, the following vulnerability has been resolved: serial: samsung: don't leak the tty on an RX IRQ s3c24xx_serial_rx_chaCVE-2026-142997In the Linux kernel, the following vulnerability has been resolved: serial: imx: fix the tty reference of the wakeup event To report a wakCVE-2026-142998In the Linux kernel, the following vulnerability has been resolved: serial: fsl_lpuart: fix tty ref of wakeup event To report a wakeup eveCVE-2026-142999In the Linux kernel, the following vulnerability has been resolved: serial: core: respect runtime PM when sending x_char __uart_start() ca
CVE-2026-142987: Unscored | Vulnix