CVE-2023-54180 (GCVE-0-2023-54180)
Vulnerability from cvelistv5
Published
2025-12-30 12:08
Modified
2025-12-30 12:08
Severity ?
Summary
In the Linux kernel, the following vulnerability has been resolved: btrfs: handle case when repair happens with dev-replace [BUG] There is a bug report that a BUG_ON() in btrfs_repair_io_failure() (originally repair_io_failure() in v6.0 kernel) got triggered when replacing a unreliable disk: BTRFS warning (device sda1): csum failed root 257 ino 2397453 off 39624704 csum 0xb0d18c75 expected csum 0x4dae9c5e mirror 3 kernel BUG at fs/btrfs/extent_io.c:2380! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 9 PID: 3614331 Comm: kworker/u257:2 Tainted: G OE 6.0.0-5-amd64 #1 Debian 6.0.10-2 Hardware name: Micro-Star International Co., Ltd. MS-7C60/TRX40 PRO WIFI (MS-7C60), BIOS 2.70 07/01/2021 Workqueue: btrfs-endio btrfs_end_bio_work [btrfs] RIP: 0010:repair_io_failure+0x24a/0x260 [btrfs] Call Trace: <TASK> clean_io_failure+0x14d/0x180 [btrfs] end_bio_extent_readpage+0x412/0x6e0 [btrfs] ? __switch_to+0x106/0x420 process_one_work+0x1c7/0x380 worker_thread+0x4d/0x380 ? rescuer_thread+0x3a0/0x3a0 kthread+0xe9/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 [CAUSE] Before the BUG_ON(), we got some read errors from the replace target first, note the mirror number (3, which is beyond RAID1 duplication, thus it's read from the replace target device). Then at the BUG_ON() location, we are trying to writeback the repaired sectors back the failed device. The check looks like this: ret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical, &map_length, &bioc, mirror_num); if (ret) goto out_counter_dec; BUG_ON(mirror_num != bioc->mirror_num); But inside btrfs_map_block(), we can modify bioc->mirror_num especially for dev-replace: if (dev_replace_is_ongoing && mirror_num == map->num_stripes + 1 && !need_full_stripe(op) && dev_replace->tgtdev != NULL) { ret = get_extra_mirror_from_replace(fs_info, logical, *length, dev_replace->srcdev->devid, &mirror_num, &physical_to_patch_in_first_stripe); patch_the_first_stripe_for_dev_replace = 1; } Thus if we're repairing the replace target device, we're going to trigger that BUG_ON(). But in reality, the read failure from the replace target device may be that, our replace hasn't reached the range we're reading, thus we're reading garbage, but with replace running, the range would be properly filled later. Thus in that case, we don't need to do anything but let the replace routine to handle it. [FIX] Instead of a BUG_ON(), just skip the repair if we're repairing the device replace target device.
Impacted products
Vendor Product Version
Linux Linux Version: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
Version: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
Version: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "fs/btrfs/bio.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "a7018b40b49c37fb55736499f790ec0d2b381ae4",
              "status": "affected",
              "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
              "versionType": "git"
            },
            {
              "lessThan": "53e9d6851b56626885476a2966194ba994f8bb4b",
              "status": "affected",
              "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
              "versionType": "git"
            },
            {
              "lessThan": "d73a27b86fc722c28a26ec64002e3a7dc86d1c07",
              "status": "affected",
              "version": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "fs/btrfs/bio.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThanOrEqual": "6.0.*",
              "status": "unaffected",
              "version": "6.0.19",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.5",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.2",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.0.19",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.1.5",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.2",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: handle case when repair happens with dev-replace\n\n[BUG]\nThere is a bug report that a BUG_ON() in btrfs_repair_io_failure()\n(originally repair_io_failure() in v6.0 kernel) got triggered when\nreplacing a unreliable disk:\n\n  BTRFS warning (device sda1): csum failed root 257 ino 2397453 off 39624704 csum 0xb0d18c75 expected csum 0x4dae9c5e mirror 3\n  kernel BUG at fs/btrfs/extent_io.c:2380!\n  invalid opcode: 0000 [#1] PREEMPT SMP NOPTI\n  CPU: 9 PID: 3614331 Comm: kworker/u257:2 Tainted: G           OE      6.0.0-5-amd64 #1  Debian 6.0.10-2\n  Hardware name: Micro-Star International Co., Ltd. MS-7C60/TRX40 PRO WIFI (MS-7C60), BIOS 2.70 07/01/2021\n  Workqueue: btrfs-endio btrfs_end_bio_work [btrfs]\n  RIP: 0010:repair_io_failure+0x24a/0x260 [btrfs]\n  Call Trace:\n   \u003cTASK\u003e\n   clean_io_failure+0x14d/0x180 [btrfs]\n   end_bio_extent_readpage+0x412/0x6e0 [btrfs]\n   ? __switch_to+0x106/0x420\n   process_one_work+0x1c7/0x380\n   worker_thread+0x4d/0x380\n   ? rescuer_thread+0x3a0/0x3a0\n   kthread+0xe9/0x110\n   ? kthread_complete_and_exit+0x20/0x20\n   ret_from_fork+0x22/0x30\n\n[CAUSE]\n\nBefore the BUG_ON(), we got some read errors from the replace target\nfirst, note the mirror number (3, which is beyond RAID1 duplication,\nthus it\u0027s read from the replace target device).\n\nThen at the BUG_ON() location, we are trying to writeback the repaired\nsectors back the failed device.\n\nThe check looks like this:\n\n\t\tret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical,\n\t\t\t\t      \u0026map_length, \u0026bioc, mirror_num);\n\t\tif (ret)\n\t\t\tgoto out_counter_dec;\n\t\tBUG_ON(mirror_num != bioc-\u003emirror_num);\n\nBut inside btrfs_map_block(), we can modify bioc-\u003emirror_num especially\nfor dev-replace:\n\n\tif (dev_replace_is_ongoing \u0026\u0026 mirror_num == map-\u003enum_stripes + 1 \u0026\u0026\n\t    !need_full_stripe(op) \u0026\u0026 dev_replace-\u003etgtdev != NULL) {\n\t\tret = get_extra_mirror_from_replace(fs_info, logical, *length,\n\t\t\t\t\t\t    dev_replace-\u003esrcdev-\u003edevid,\n\t\t\t\t\t\t    \u0026mirror_num,\n\t\t\t\t\t    \u0026physical_to_patch_in_first_stripe);\n\t\tpatch_the_first_stripe_for_dev_replace = 1;\n\t}\n\nThus if we\u0027re repairing the replace target device, we\u0027re going to\ntrigger that BUG_ON().\n\nBut in reality, the read failure from the replace target device may be\nthat, our replace hasn\u0027t reached the range we\u0027re reading, thus we\u0027re\nreading garbage, but with replace running, the range would be properly\nfilled later.\n\nThus in that case, we don\u0027t need to do anything but let the replace\nroutine to handle it.\n\n[FIX]\nInstead of a BUG_ON(), just skip the repair if we\u0027re repairing the\ndevice replace target device."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-12-30T12:08:51.727Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/a7018b40b49c37fb55736499f790ec0d2b381ae4"
        },
        {
          "url": "https://git.kernel.org/stable/c/53e9d6851b56626885476a2966194ba994f8bb4b"
        },
        {
          "url": "https://git.kernel.org/stable/c/d73a27b86fc722c28a26ec64002e3a7dc86d1c07"
        }
      ],
      "title": "btrfs: handle case when repair happens with dev-replace",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2023-54180",
    "datePublished": "2025-12-30T12:08:51.727Z",
    "dateReserved": "2025-12-30T12:06:44.497Z",
    "dateUpdated": "2025-12-30T12:08:51.727Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2023-54180\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-12-30T13:16:05.933\",\"lastModified\":\"2025-12-30T13:16:05.933\",\"vulnStatus\":\"Received\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbtrfs: handle case when repair happens with dev-replace\\n\\n[BUG]\\nThere is a bug report that a BUG_ON() in btrfs_repair_io_failure()\\n(originally repair_io_failure() in v6.0 kernel) got triggered when\\nreplacing a unreliable disk:\\n\\n  BTRFS warning (device sda1): csum failed root 257 ino 2397453 off 39624704 csum 0xb0d18c75 expected csum 0x4dae9c5e mirror 3\\n  kernel BUG at fs/btrfs/extent_io.c:2380!\\n  invalid opcode: 0000 [#1] PREEMPT SMP NOPTI\\n  CPU: 9 PID: 3614331 Comm: kworker/u257:2 Tainted: G           OE      6.0.0-5-amd64 #1  Debian 6.0.10-2\\n  Hardware name: Micro-Star International Co., Ltd. MS-7C60/TRX40 PRO WIFI (MS-7C60), BIOS 2.70 07/01/2021\\n  Workqueue: btrfs-endio btrfs_end_bio_work [btrfs]\\n  RIP: 0010:repair_io_failure+0x24a/0x260 [btrfs]\\n  Call Trace:\\n   \u003cTASK\u003e\\n   clean_io_failure+0x14d/0x180 [btrfs]\\n   end_bio_extent_readpage+0x412/0x6e0 [btrfs]\\n   ? __switch_to+0x106/0x420\\n   process_one_work+0x1c7/0x380\\n   worker_thread+0x4d/0x380\\n   ? rescuer_thread+0x3a0/0x3a0\\n   kthread+0xe9/0x110\\n   ? kthread_complete_and_exit+0x20/0x20\\n   ret_from_fork+0x22/0x30\\n\\n[CAUSE]\\n\\nBefore the BUG_ON(), we got some read errors from the replace target\\nfirst, note the mirror number (3, which is beyond RAID1 duplication,\\nthus it\u0027s read from the replace target device).\\n\\nThen at the BUG_ON() location, we are trying to writeback the repaired\\nsectors back the failed device.\\n\\nThe check looks like this:\\n\\n\\t\\tret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical,\\n\\t\\t\\t\\t      \u0026map_length, \u0026bioc, mirror_num);\\n\\t\\tif (ret)\\n\\t\\t\\tgoto out_counter_dec;\\n\\t\\tBUG_ON(mirror_num != bioc-\u003emirror_num);\\n\\nBut inside btrfs_map_block(), we can modify bioc-\u003emirror_num especially\\nfor dev-replace:\\n\\n\\tif (dev_replace_is_ongoing \u0026\u0026 mirror_num == map-\u003enum_stripes + 1 \u0026\u0026\\n\\t    !need_full_stripe(op) \u0026\u0026 dev_replace-\u003etgtdev != NULL) {\\n\\t\\tret = get_extra_mirror_from_replace(fs_info, logical, *length,\\n\\t\\t\\t\\t\\t\\t    dev_replace-\u003esrcdev-\u003edevid,\\n\\t\\t\\t\\t\\t\\t    \u0026mirror_num,\\n\\t\\t\\t\\t\\t    \u0026physical_to_patch_in_first_stripe);\\n\\t\\tpatch_the_first_stripe_for_dev_replace = 1;\\n\\t}\\n\\nThus if we\u0027re repairing the replace target device, we\u0027re going to\\ntrigger that BUG_ON().\\n\\nBut in reality, the read failure from the replace target device may be\\nthat, our replace hasn\u0027t reached the range we\u0027re reading, thus we\u0027re\\nreading garbage, but with replace running, the range would be properly\\nfilled later.\\n\\nThus in that case, we don\u0027t need to do anything but let the replace\\nroutine to handle it.\\n\\n[FIX]\\nInstead of a BUG_ON(), just skip the repair if we\u0027re repairing the\\ndevice replace target device.\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/53e9d6851b56626885476a2966194ba994f8bb4b\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/a7018b40b49c37fb55736499f790ec0d2b381ae4\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/d73a27b86fc722c28a26ec64002e3a7dc86d1c07\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


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 seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…