PT-2026-166842

CVE-2026-142987

·

Published

2026-12-03

·

Updated

2026-12-03

Description by

Score
N/A
Not available

No severity ratings or metrics are available. When they are, we'll update the corresponding info on the page.

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.
Vendors
Affected products
Related identifiers
Found an issue in the description? Have something to add? Feel free to write us 👾