{"id":"CVE-2026-143028","state":"PUBLISHED","title":"dm: fix use-after-free when dm_get_device() widens the open mode","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ndm: fix use-after-free when dm_get_device() widens the open mode\n\nThere's an UAF bug in dm_get_device(): when a table construction calls\ndm_get_device() on the same device twice with widen access mode (e.g.,\nread-only first then read-write), the second dm_get_device() calls\nupgrade_mode(), which reopens the device in upgraded mode, making\npreviously returned dm_dev* a stale pointer.\n\nFixing approaches:\n- Add per-mode views (dm_dev_ref) from a per-device dm_dev_internal to\n  multiple table_devices.\n- Keep reusing the dm_dev_ref when the requested mode is included, i.e.,\n  a read-only reference can reuse the read-write opened device within a\n  table.\n- Maintain a canonical block_device pointer in dm_dev_internal for\n  handling the DM_TABLE_DEPS ioctl.\n\nAlso tweak the way of mode sharing check in find_ref() to\n\"(x & mask) == mask\". The result stays the same to the previous\nupgrade_mode() guard \"(x | mask) == x\".\n\nPros: keep the relationship between dm_dev_internal and table_device:\none dm_dev_internal per device, regardless the mode, so the output of\nDMM_TABLE_DEPS ioctl unchanged.\n\nCons: extra dm_dev_ref allocation.\n\nNote that now the table_device's count not necessarily mean the number\ntables referecing this <dev, mode> pair, since we're allowing multiple\nreferences within a table.","publishedAt":"2026-12-03T09:18:03.749Z","updatedAt":"2026-12-03T09:18:03.749Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"86f1152b117a404229fd6f08ec3faca779f37b92","status":"affected","lessThan":"fc0e745c74a4344c330e38cde824ef611a15d219","versionType":"git"},{"version":"86f1152b117a404229fd6f08ec3faca779f37b92","status":"affected","lessThan":"c834161ded1a141a58d5f03b24f6894291222c96","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/md/dm-ioctl.c","drivers/md/dm-table.c","drivers/md/dm.c","drivers/md/dm.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.18","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.18","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/md/dm-ioctl.c","drivers/md/dm-table.c","drivers/md/dm.c","drivers/md/dm.h"]}],"references":["https://git.kernel.org/stable/c/fc0e745c74a4344c330e38cde824ef611a15d219","https://git.kernel.org/stable/c/c834161ded1a141a58d5f03b24f6894291222c96"],"weaknesses":[],"ingestedAt":"2026-12-03T09:26:06.073Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/143xxx/CVE-2026-143028.json","commit":"9fd484e43f2e14021809e195d28c1172759faad0","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-143028","state":"PUBLISHED","datePublished":"2026-12-03T09:18:03.749Z","dateUpdated":"2026-12-03T09:18:03.749Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-12-03T03:10:28.344Z"},"containers":{"cna":{"title":"dm: fix use-after-free when dm_get_device() widens the open mode","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ndm: fix use-after-free when dm_get_device() widens the open mode\n\nThere's an UAF bug in dm_get_device(): when a table construction calls\ndm_get_device() on the same device twice with widen access mode (e.g.,\nread-only first then read-write), the second dm_get_device() calls\nupgrade_mode(), which reopens the device in upgraded mode, making\npreviously returned dm_dev* a stale pointer.\n\nFixing approaches:\n- Add per-mode views (dm_dev_ref) from a per-device dm_dev_internal to\n  multiple table_devices.\n- Keep reusing the dm_dev_ref when the requested mode is included, i.e.,\n  a read-only reference can reuse the read-write opened device within a\n  table.\n- Maintain a canonical block_device pointer in dm_dev_internal for\n  handling the DM_TABLE_DEPS ioctl.\n\nAlso tweak the way of mode sharing check in find_ref() to\n\"(x & mask) == mask\". The result stays the same to the previous\nupgrade_mode() guard \"(x | mask) == x\".\n\nPros: keep the relationship between dm_dev_internal and table_device:\none dm_dev_internal per device, regardless the mode, so the output of\nDMM_TABLE_DEPS ioctl unchanged.\n\nCons: extra dm_dev_ref allocation.\n\nNote that now the table_device's count not necessarily mean the number\ntables referecing this <dev, mode> pair, since we're allowing multiple\nreferences within a table."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"86f1152b117a404229fd6f08ec3faca779f37b92","status":"affected","lessThan":"fc0e745c74a4344c330e38cde824ef611a15d219","versionType":"git"},{"version":"86f1152b117a404229fd6f08ec3faca779f37b92","status":"affected","lessThan":"c834161ded1a141a58d5f03b24f6894291222c96","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/md/dm-ioctl.c","drivers/md/dm-table.c","drivers/md/dm.c","drivers/md/dm.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.18","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.18","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/md/dm-ioctl.c","drivers/md/dm-table.c","drivers/md/dm.c","drivers/md/dm.h"]}],"references":[{"url":"https://git.kernel.org/stable/c/fc0e745c74a4344c330e38cde824ef611a15d219"},{"url":"https://git.kernel.org/stable/c/c834161ded1a141a58d5f03b24f6894291222c96"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-12-03T09:18:03.749Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.18","versionEndExcluding":"7.3.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.18","versionEndExcluding":"7.4-rc3"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}