{"id":"AZL-117881","summary":"CVE-2026-142987 affecting package kernel 6.6.161.1-1","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF\n\nfsg_store_nofua() syncs the LUN's backing file when switching from async\nto sync mode:\n\n\tif (!nofua && curlun-\u003enofua)\n\t\tfsg_lun_fsync_sub(curlun);\n\nfsg_lun_fsync_sub() dereferences curlun-\u003efilp (vfs_fsync(filp)). Unlike\nevery other store that touches the backing file -- fsg_store_ro() and\nfsg_store_cdrom() (down_read), fsg_store_file() (down_write) --\nfsg_store_nofua() holds no filesem while doing so.\n\nA concurrent close of the backing file runs under down_write(filesem) and\ndoes fput(curlun-\u003efilp) in fsg_lun_close() (fsg_store_file() with an empty\npath, the SCSI START_STOP eject in do_start_stop(), or forced_eject), so\nit can free the file while fsg_store_nofua() is dereferencing it:\n\n\tBUG: KASAN: slab-use-after-free in vfs_fsync+0x20/0xe0\n\t vfs_fsync+0x20/0xe0\n\t fsg_lun_fsync_sub+0xa0/0xd0\n\t fsg_store_nofua+0x138/0x160\n\t configfs_write_iter+0x1a7/0x250\n\t vfs_write+0x5df/0x940\n\tAllocated by task 3459:\n\t fsg_store_file+0x150/0x1f0\n\t configfs_write_iter+0x1a7/0x250\n\tFreed by task 3459:\n\t __fput+0x456/0x6c0\n\t __fput_deferred+0x10d/0x330\n\t fsg_store_file+0x9e/0x1f0\n\t configfs_write_iter+0x1a7/0x250\n\nHold filesem for read around the fsync in fsg_store_nofua() so the backing\nfile cannot be closed underneath it. The lock is only needed when the\nfsync actually runs, so it is taken only in that branch.\n\nReproduced on a mass_storage gadget over dummy_hcd by writing lun.N/nofua\n(1 then 0) from one task while another task rewrites and clears lun.N/file.","modified":"2026-12-04T14:18:39.380556395Z","published":"2026-12-03T10:17:23Z","upstream":["CVE-2026-142987"],"references":[{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-142987"}],"affected":[{"package":{"name":"kernel","ecosystem":"Azure Linux:3","purl":"pkg:rpm/azure-linux/kernel"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"6.6.161.1-1"}]}],"database_specific":{"source":"https://github.com/microsoft/AzureLinuxVulnerabilityData/blob/main/osv/AZL-117881.json"}}],"schema_version":"1.9.2"}