{"url":"http://public2.vulnerablecode.io/api/vulnerabilities/57095?format=json","vulnerability_id":"VCID-zkwx-n4qj-nue4","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: scrub: handle RST lookup error correctly\n\n[BUG]\nWhen running btrfs/060 with forced RST feature, it would crash the\nfollowing ASSERT() inside scrub_read_endio():\n\n\tASSERT(sector_nr < stripe->nr_sectors);\n\nBefore that, we would have tree dump from\nbtrfs_get_raid_extent_offset(), as we failed to find the RST entry for\nthe range.\n\n[CAUSE]\nInside scrub_submit_extent_sector_read() every time we allocated a new\nbbio we immediately called btrfs_map_block() to make sure there was some\nRST range covering the scrub target.\n\nBut if btrfs_map_block() fails, we immediately call endio for the bbio,\nwhile the bbio is newly allocated, it's completely empty.\n\nThen inside scrub_read_endio(), we go through the bvecs to find\nthe sector number (as bi_sector is no longer reliable if the bio is\nsubmitted to lower layers).\n\nAnd since the bio is empty, such bvecs iteration would not find any\nsector matching the sector, and return sector_nr == stripe->nr_sectors,\ntriggering the ASSERT().\n\n[FIX]\nInstead of calling btrfs_map_block() after allocating a new bbio, call\nbtrfs_map_block() first.\n\nSince our only objective of calling btrfs_map_block() is only to update\nstripe_len, there is really no need to do that after btrfs_alloc_bio().\n\nThis new timing would avoid the problem of handling empty bbio\ncompletely, and in fact fixes a possible race window for the old code,\nwhere if the submission thread is the only owner of the pending_io, the\nscrub would never finish (since we didn't decrease the pending_io\ncounter).\n\nAlthough the root cause of RST lookup failure still needs to be\naddressed.","aliases":[{"alias":"CVE-2024-41067"}],"fixed_packages":[],"affected_packages":[],"references":[{"reference_url":"https://git.kernel.org/stable/c/17d1fd302a53d7e456a7412da74be74a0cf63a72","reference_id":"17d1fd302a53d7e456a7412da74be74a0cf63a72","reference_type":"","scores":[{"value":"Track","scoring_system":"ssvc","scoring_elements":"SSVCv2/E:N/A:N/T:P/P:M/B:A/M:M/D:T/2024-09-10T16:21:49Z/"}],"url":"https://git.kernel.org/stable/c/17d1fd302a53d7e456a7412da74be74a0cf63a72"},{"reference_url":"https://git.kernel.org/stable/c/2c49908634a2b97b1c3abe0589be2739ac5e7fd5","reference_id":"2c49908634a2b97b1c3abe0589be2739ac5e7fd5","reference_type":"","scores":[{"value":"Track","scoring_system":"ssvc","scoring_elements":"SSVCv2/E:N/A:N/T:P/P:M/B:A/M:M/D:T/2024-09-10T16:21:49Z/"}],"url":"https://git.kernel.org/stable/c/2c49908634a2b97b1c3abe0589be2739ac5e7fd5"}],"weaknesses":[],"exploits":[],"severity_range_score":null,"exploitability":null,"weighted_severity":null,"risk_score":null,"resource_url":"http://public2.vulnerablecode.io/vulnerabilities/VCID-zkwx-n4qj-nue4"}