CVE-2021-47508 (GCVE-0-2021-47508)

Vulnerability from cvelistv5 – Published: 2024-05-24 15:01 – Updated: 2025-12-18 11:37
VLAI?
Title
btrfs: free exchange changeset on failures
Summary
In the Linux kernel, the following vulnerability has been resolved: btrfs: free exchange changeset on failures Fstests runs on my VMs have show several kmemleak reports like the following. unreferenced object 0xffff88811ae59080 (size 64): comm "xfs_io", pid 12124, jiffies 4294987392 (age 6.368s) hex dump (first 32 bytes): 00 c0 1c 00 00 00 00 00 ff cf 1c 00 00 00 00 00 ................ 90 97 e5 1a 81 88 ff ff 90 97 e5 1a 81 88 ff ff ................ backtrace: [<00000000ac0176d2>] ulist_add_merge+0x60/0x150 [btrfs] [<0000000076e9f312>] set_state_bits+0x86/0xc0 [btrfs] [<0000000014fe73d6>] set_extent_bit+0x270/0x690 [btrfs] [<000000004f675208>] set_record_extent_bits+0x19/0x20 [btrfs] [<00000000b96137b1>] qgroup_reserve_data+0x274/0x310 [btrfs] [<0000000057e9dcbb>] btrfs_check_data_free_space+0x5c/0xa0 [btrfs] [<0000000019c4511d>] btrfs_delalloc_reserve_space+0x1b/0xa0 [btrfs] [<000000006d37e007>] btrfs_dio_iomap_begin+0x415/0x970 [btrfs] [<00000000fb8a74b8>] iomap_iter+0x161/0x1e0 [<0000000071dff6ff>] __iomap_dio_rw+0x1df/0x700 [<000000002567ba53>] iomap_dio_rw+0x5/0x20 [<0000000072e555f8>] btrfs_file_write_iter+0x290/0x530 [btrfs] [<000000005eb3d845>] new_sync_write+0x106/0x180 [<000000003fb505bf>] vfs_write+0x24d/0x2f0 [<000000009bb57d37>] __x64_sys_pwrite64+0x69/0xa0 [<000000003eba3fdf>] do_syscall_64+0x43/0x90 In case brtfs_qgroup_reserve_data() or btrfs_delalloc_reserve_metadata() fail the allocated extent_changeset will not be freed. So in btrfs_check_data_free_space() and btrfs_delalloc_reserve_space() free the allocated extent_changeset to get rid of the allocated memory. The issue currently only happens in the direct IO write path, but only after 65b3c08606e5 ("btrfs: fix ENOSPC failure when attempting direct IO write into NOCOW range"), and also at defrag_one_locked_target(). Every other place is always calling extent_changeset_free() even if its call to btrfs_delalloc_reserve_space() or btrfs_check_data_free_space() has failed.
Severity ?
No CVSS data available.
Assigner
Impacted products
Vendor Product Version
Linux Linux Affected: 364ecf3651e0862152c8b340d7cb3021dc0122c7 , < ca06c5cb1b6dbfe67655b33c02fc394d65824519 (git)
Affected: 364ecf3651e0862152c8b340d7cb3021dc0122c7 , < da5e817d9d75422eaaa05490d0b9a5e328fc1a51 (git)
Create a notification for this product.
    Linux Linux Affected: 4.13
Unaffected: 0 , < 4.13 (semver)
Unaffected: 5.15.8 , ≤ 5.15.* (semver)
Unaffected: 5.16 , ≤ * (original_commit_for_fix)
Create a notification for this product.
Show details on NVD website

{
  "containers": {
    "adp": [
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-04T05:39:59.770Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/ca06c5cb1b6dbfe67655b33c02fc394d65824519"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/da5e817d9d75422eaaa05490d0b9a5e328fc1a51"
          }
        ],
        "title": "CVE Program Container"
      },
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2021-47508",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-09-10T15:35:39.656794Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-09-11T17:33:22.299Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "fs/btrfs/delalloc-space.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "ca06c5cb1b6dbfe67655b33c02fc394d65824519",
              "status": "affected",
              "version": "364ecf3651e0862152c8b340d7cb3021dc0122c7",
              "versionType": "git"
            },
            {
              "lessThan": "da5e817d9d75422eaaa05490d0b9a5e328fc1a51",
              "status": "affected",
              "version": "364ecf3651e0862152c8b340d7cb3021dc0122c7",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "fs/btrfs/delalloc-space.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "4.13"
            },
            {
              "lessThan": "4.13",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.8",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "5.16",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.15.8",
                  "versionStartIncluding": "4.13",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.16",
                  "versionStartIncluding": "4.13",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: free exchange changeset on failures\n\nFstests runs on my VMs have show several kmemleak reports like the following.\n\n  unreferenced object 0xffff88811ae59080 (size 64):\n    comm \"xfs_io\", pid 12124, jiffies 4294987392 (age 6.368s)\n    hex dump (first 32 bytes):\n      00 c0 1c 00 00 00 00 00 ff cf 1c 00 00 00 00 00  ................\n      90 97 e5 1a 81 88 ff ff 90 97 e5 1a 81 88 ff ff  ................\n    backtrace:\n      [\u003c00000000ac0176d2\u003e] ulist_add_merge+0x60/0x150 [btrfs]\n      [\u003c0000000076e9f312\u003e] set_state_bits+0x86/0xc0 [btrfs]\n      [\u003c0000000014fe73d6\u003e] set_extent_bit+0x270/0x690 [btrfs]\n      [\u003c000000004f675208\u003e] set_record_extent_bits+0x19/0x20 [btrfs]\n      [\u003c00000000b96137b1\u003e] qgroup_reserve_data+0x274/0x310 [btrfs]\n      [\u003c0000000057e9dcbb\u003e] btrfs_check_data_free_space+0x5c/0xa0 [btrfs]\n      [\u003c0000000019c4511d\u003e] btrfs_delalloc_reserve_space+0x1b/0xa0 [btrfs]\n      [\u003c000000006d37e007\u003e] btrfs_dio_iomap_begin+0x415/0x970 [btrfs]\n      [\u003c00000000fb8a74b8\u003e] iomap_iter+0x161/0x1e0\n      [\u003c0000000071dff6ff\u003e] __iomap_dio_rw+0x1df/0x700\n      [\u003c000000002567ba53\u003e] iomap_dio_rw+0x5/0x20\n      [\u003c0000000072e555f8\u003e] btrfs_file_write_iter+0x290/0x530 [btrfs]\n      [\u003c000000005eb3d845\u003e] new_sync_write+0x106/0x180\n      [\u003c000000003fb505bf\u003e] vfs_write+0x24d/0x2f0\n      [\u003c000000009bb57d37\u003e] __x64_sys_pwrite64+0x69/0xa0\n      [\u003c000000003eba3fdf\u003e] do_syscall_64+0x43/0x90\n\nIn case brtfs_qgroup_reserve_data() or btrfs_delalloc_reserve_metadata()\nfail the allocated extent_changeset will not be freed.\n\nSo in btrfs_check_data_free_space() and btrfs_delalloc_reserve_space()\nfree the allocated extent_changeset to get rid of the allocated memory.\n\nThe issue currently only happens in the direct IO write path, but only\nafter 65b3c08606e5 (\"btrfs: fix ENOSPC failure when attempting direct IO\nwrite into NOCOW range\"), and also at defrag_one_locked_target(). Every\nother place is always calling extent_changeset_free() even if its call\nto btrfs_delalloc_reserve_space() or btrfs_check_data_free_space() has\nfailed."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-12-18T11:37:45.889Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/ca06c5cb1b6dbfe67655b33c02fc394d65824519"
        },
        {
          "url": "https://git.kernel.org/stable/c/da5e817d9d75422eaaa05490d0b9a5e328fc1a51"
        }
      ],
      "title": "btrfs: free exchange changeset on failures",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2021-47508",
    "datePublished": "2024-05-24T15:01:54.048Z",
    "dateReserved": "2024-05-22T06:20:56.206Z",
    "dateUpdated": "2025-12-18T11:37:45.889Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "vulnrichment": {
      "containers": "{\"adp\": [{\"title\": \"CVE Program Container\", \"references\": [{\"url\": \"https://git.kernel.org/stable/c/ca06c5cb1b6dbfe67655b33c02fc394d65824519\", \"tags\": [\"x_transferred\"]}, {\"url\": \"https://git.kernel.org/stable/c/da5e817d9d75422eaaa05490d0b9a5e328fc1a51\", \"tags\": [\"x_transferred\"]}], \"providerMetadata\": {\"orgId\": \"af854a3a-2127-422b-91ae-364da2661108\", \"shortName\": \"CVE\", \"dateUpdated\": \"2024-08-04T05:39:59.770Z\"}}, {\"title\": \"CISA ADP Vulnrichment\", \"metrics\": [{\"other\": {\"type\": \"ssvc\", \"content\": {\"id\": \"CVE-2021-47508\", \"role\": \"CISA Coordinator\", \"options\": [{\"Exploitation\": \"none\"}, {\"Automatable\": \"no\"}, {\"Technical Impact\": \"partial\"}], \"version\": \"2.0.3\", \"timestamp\": \"2024-09-10T15:35:39.656794Z\"}}}], \"providerMetadata\": {\"orgId\": \"134c704f-9b21-4f2e-91b3-4a467353bcc0\", \"shortName\": \"CISA-ADP\", \"dateUpdated\": \"2024-09-11T12:42:16.372Z\"}}], \"cna\": {\"title\": \"btrfs: free exchange changeset on failures\", \"affected\": [{\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"364ecf3651e0862152c8b340d7cb3021dc0122c7\", \"lessThan\": \"ca06c5cb1b6dbfe67655b33c02fc394d65824519\", \"versionType\": \"git\"}, {\"status\": \"affected\", \"version\": \"364ecf3651e0862152c8b340d7cb3021dc0122c7\", \"lessThan\": \"da5e817d9d75422eaaa05490d0b9a5e328fc1a51\", \"versionType\": \"git\"}], \"programFiles\": [\"fs/btrfs/delalloc-space.c\"], \"defaultStatus\": \"unaffected\"}, {\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"4.13\"}, {\"status\": \"unaffected\", \"version\": \"0\", \"lessThan\": \"4.13\", \"versionType\": \"semver\"}, {\"status\": \"unaffected\", \"version\": \"5.15.8\", \"versionType\": \"semver\", \"lessThanOrEqual\": \"5.15.*\"}, {\"status\": \"unaffected\", \"version\": \"5.16\", \"versionType\": \"original_commit_for_fix\", \"lessThanOrEqual\": \"*\"}], \"programFiles\": [\"fs/btrfs/delalloc-space.c\"], \"defaultStatus\": \"affected\"}], \"references\": [{\"url\": \"https://git.kernel.org/stable/c/ca06c5cb1b6dbfe67655b33c02fc394d65824519\"}, {\"url\": \"https://git.kernel.org/stable/c/da5e817d9d75422eaaa05490d0b9a5e328fc1a51\"}], \"x_generator\": {\"engine\": \"bippy-1.2.0\"}, \"descriptions\": [{\"lang\": \"en\", \"value\": \"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbtrfs: free exchange changeset on failures\\n\\nFstests runs on my VMs have show several kmemleak reports like the following.\\n\\n  unreferenced object 0xffff88811ae59080 (size 64):\\n    comm \\\"xfs_io\\\", pid 12124, jiffies 4294987392 (age 6.368s)\\n    hex dump (first 32 bytes):\\n      00 c0 1c 00 00 00 00 00 ff cf 1c 00 00 00 00 00  ................\\n      90 97 e5 1a 81 88 ff ff 90 97 e5 1a 81 88 ff ff  ................\\n    backtrace:\\n      [\u003c00000000ac0176d2\u003e] ulist_add_merge+0x60/0x150 [btrfs]\\n      [\u003c0000000076e9f312\u003e] set_state_bits+0x86/0xc0 [btrfs]\\n      [\u003c0000000014fe73d6\u003e] set_extent_bit+0x270/0x690 [btrfs]\\n      [\u003c000000004f675208\u003e] set_record_extent_bits+0x19/0x20 [btrfs]\\n      [\u003c00000000b96137b1\u003e] qgroup_reserve_data+0x274/0x310 [btrfs]\\n      [\u003c0000000057e9dcbb\u003e] btrfs_check_data_free_space+0x5c/0xa0 [btrfs]\\n      [\u003c0000000019c4511d\u003e] btrfs_delalloc_reserve_space+0x1b/0xa0 [btrfs]\\n      [\u003c000000006d37e007\u003e] btrfs_dio_iomap_begin+0x415/0x970 [btrfs]\\n      [\u003c00000000fb8a74b8\u003e] iomap_iter+0x161/0x1e0\\n      [\u003c0000000071dff6ff\u003e] __iomap_dio_rw+0x1df/0x700\\n      [\u003c000000002567ba53\u003e] iomap_dio_rw+0x5/0x20\\n      [\u003c0000000072e555f8\u003e] btrfs_file_write_iter+0x290/0x530 [btrfs]\\n      [\u003c000000005eb3d845\u003e] new_sync_write+0x106/0x180\\n      [\u003c000000003fb505bf\u003e] vfs_write+0x24d/0x2f0\\n      [\u003c000000009bb57d37\u003e] __x64_sys_pwrite64+0x69/0xa0\\n      [\u003c000000003eba3fdf\u003e] do_syscall_64+0x43/0x90\\n\\nIn case brtfs_qgroup_reserve_data() or btrfs_delalloc_reserve_metadata()\\nfail the allocated extent_changeset will not be freed.\\n\\nSo in btrfs_check_data_free_space() and btrfs_delalloc_reserve_space()\\nfree the allocated extent_changeset to get rid of the allocated memory.\\n\\nThe issue currently only happens in the direct IO write path, but only\\nafter 65b3c08606e5 (\\\"btrfs: fix ENOSPC failure when attempting direct IO\\nwrite into NOCOW range\\\"), and also at defrag_one_locked_target(). Every\\nother place is always calling extent_changeset_free() even if its call\\nto btrfs_delalloc_reserve_space() or btrfs_check_data_free_space() has\\nfailed.\"}], \"cpeApplicability\": [{\"nodes\": [{\"negate\": false, \"cpeMatch\": [{\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"5.15.8\", \"versionStartIncluding\": \"4.13\"}, {\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"5.16\", \"versionStartIncluding\": \"4.13\"}], \"operator\": \"OR\"}]}], \"providerMetadata\": {\"orgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"shortName\": \"Linux\", \"dateUpdated\": \"2025-12-09T21:43:38.764Z\"}}}",
      "cveMetadata": "{\"cveId\": \"CVE-2021-47508\", \"state\": \"PUBLISHED\", \"dateUpdated\": \"2025-12-09T21:43:38.764Z\", \"dateReserved\": \"2024-05-22T06:20:56.206Z\", \"assignerOrgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"datePublished\": \"2024-05-24T15:01:54.048Z\", \"assignerShortName\": \"Linux\"}",
      "dataType": "CVE_RECORD",
      "dataVersion": "5.2"
    }
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…