{
  "affected": [
    {
      "ranges": [
        {
          "events": [
            {
              "introduced": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2"
            },
            {
              "fixed": "94bc557fc0c78e7c148974baf0be33db9b3cbc93"
            },
            {
              "fixed": "02d11b2e20bbd98b6496458ebc7522f6d429dc36"
            },
            {
              "fixed": "2ef64b32ceb561e85d572ed2b7aaa45d36087f26"
            },
            {
              "fixed": "5c0e66058314fc994feef9e1a1879146ea3698b6"
            },
            {
              "fixed": "efe2605be71f6f22dcdf08fa9a0b1669e41a68d2"
            },
            {
              "fixed": "450fa94d7ae9fc91c3df525f5d1322bf8fecf7b2"
            }
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "type": "GIT"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Linux",
        "name": "Kernel"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "5.10.276"
            }
          ],
          "type": "ECOSYSTEM"
        },
        {
          "events": [
            {
              "introduced": "5.11.0"
            },
            {
              "fixed": "5.15.227"
            }
          ],
          "type": "ECOSYSTEM"
        },
        {
          "events": [
            {
              "introduced": "5.16.0"
            },
            {
              "fixed": "6.12.120"
            }
          ],
          "type": "ECOSYSTEM"
        },
        {
          "events": [
            {
              "introduced": "6.13.0"
            },
            {
              "fixed": "6.18.66"
            }
          ],
          "type": "ECOSYSTEM"
        },
        {
          "events": [
            {
              "introduced": "6.19.0"
            },
            {
              "fixed": "7.3.7"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "database_specific": {
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/142xxx/CVE-2026-142987.json"
  },
  "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 \u0026\u0026 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.",
  "id": "CVE-2026-142987",
  "modified": "2026-12-03T10:46:07.213075111Z",
  "published": "2026-12-03T09:17:18.650Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/02d11b2e20bbd98b6496458ebc7522f6d429dc36"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/2ef64b32ceb561e85d572ed2b7aaa45d36087f26"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/450fa94d7ae9fc91c3df525f5d1322bf8fecf7b2"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/5c0e66058314fc994feef9e1a1879146ea3698b6"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/94bc557fc0c78e7c148974baf0be33db9b3cbc93"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/efe2605be71f6f22dcdf08fa9a0b1669e41a68d2"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/142xxx/CVE-2026-142987.json"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-142987"
    }
  ],
  "schema_version": "1.9.2",
  "summary": "usb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF"
}