In the Linux kernel, the following vulnerability has been resolved:
btrfs: zoned: fix lock ordering in btrfszoneactivate()
The btrfs CI reported a lockdep warning as follows by running generic generic/129.
WARNING: possible circular locking dependency detected 6.7.0-rc5+ #1 Not tainted
kworker/u5:5/793427 is trying to acquire lock: ffff88813256d028 (&cache->lock){+.+.}-{2:2}, at: btrfszonefinishonebg+0x5e/0x130 but task is already holding lock: ffff88810a23a318 (&fsinfo->zoneactivebgslock){+.+.}-{2:2}, at: btrfszonefinishonebg+0x34/0x130 which lock already depends on the new lock.
the existing dependency chain (in reverse order) is: -> #1 (&fsinfo->zoneactivebgslock){+.+.}-{2:2}: ... -> #0 (&cache->lock){+.+.}-{2:2}: ...
This is because we take fsinfo->zoneactivebgslock after a blockgroup's lock in btrfszone_activate() while doing the opposite in other places.
Fix the issue by expanding the fsinfo->zoneactivebgslock's critical section and taking it before a block_group's lock.
{ "vanir_signatures": [ { "signature_type": "Function", "deprecated": false, "signature_version": "v1", "target": { "file": "fs/btrfs/zoned.c", "function": "btrfs_zone_activate" }, "id": "CVE-2023-52668-24a47e4c", "digest": { "length": 1499.0, "function_hash": "173712037070226086680563938849261185892" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b18f3b60b35a8c01c9a2a0f0d6424c6d73971dc3" }, { "signature_type": "Line", "deprecated": false, "signature_version": "v1", "target": { "file": "fs/btrfs/zoned.c" }, "id": "CVE-2023-52668-42159c7f", "digest": { "line_hashes": [ "91879074727313826573769376204998762085", "84000855341591983671877521518807400167", "65245607169604202567808808079748061681", "231896596567471076477703895924847845143", "177499630368081451291033984421778436920", "5521406794528135084606950512453595522", "11927629988472011718421457147708612199", "88078714272441640043539319927684943791", "293655380229419112751591223860349709841", "263445997021863635333765660419666484394", "96730790471352947242987445767714601803", "327008510400920750948709853423917029760", "236029329104159607247677601906746568085", "218514079533314104774421144795752363928", "263445997021863635333765660419666484394", "261260303104872113390565692994581687996", "53296694576399635625701331096623753064", "182714396245787086284422099183076885262", "192685896873880626910085634076109647160", "300297107719167794298727648323215409299", "156225988679174593034205730394635791726", "126862545344525427249221841214763690003", "46412602539008031136074189389041870506", "190993188094408341636861831843787802267", "100618956615789216858293467347642253066", "64142205729186306873882340036385802329", "8091997504248942457061597845410380151", "182785554669510067725614616914610994411", "202544923999690700432559031623657482099", "39303256047409121829410337375645733325" ], "threshold": 0.9 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1908e9d01e5395adff68d9d308a0fb15337e6272" }, { "signature_type": "Function", "deprecated": false, "signature_version": "v1", "target": { "file": "fs/btrfs/zoned.c", "function": "btrfs_zone_activate" }, "id": "CVE-2023-52668-53ecfef1", "digest": { "length": 1499.0, "function_hash": "173712037070226086680563938849261185892" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6f74989f5909cdec9b1274641f0fa306b15bb476" }, { "signature_type": "Line", "deprecated": false, "signature_version": "v1", "target": { "file": "fs/btrfs/zoned.c" }, "id": "CVE-2023-52668-ce369260", "digest": { "line_hashes": [ "91879074727313826573769376204998762085", "84000855341591983671877521518807400167", "65245607169604202567808808079748061681", "231896596567471076477703895924847845143", "177499630368081451291033984421778436920", "5521406794528135084606950512453595522", "11927629988472011718421457147708612199", "88078714272441640043539319927684943791", "293655380229419112751591223860349709841", "263445997021863635333765660419666484394", "96730790471352947242987445767714601803", "327008510400920750948709853423917029760", "236029329104159607247677601906746568085", "218514079533314104774421144795752363928", "263445997021863635333765660419666484394", "261260303104872113390565692994581687996", "53296694576399635625701331096623753064", "182714396245787086284422099183076885262", "192685896873880626910085634076109647160", "300297107719167794298727648323215409299", "156225988679174593034205730394635791726", "126862545344525427249221841214763690003", "46412602539008031136074189389041870506", "190993188094408341636861831843787802267", "100618956615789216858293467347642253066", "64142205729186306873882340036385802329", "8091997504248942457061597845410380151", "182785554669510067725614616914610994411", "202544923999690700432559031623657482099", "39303256047409121829410337375645733325" ], "threshold": 0.9 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b18f3b60b35a8c01c9a2a0f0d6424c6d73971dc3" }, { "signature_type": "Function", "deprecated": false, "signature_version": "v1", "target": { "file": "fs/btrfs/zoned.c", "function": "btrfs_zone_activate" }, "id": "CVE-2023-52668-d135c9e9", "digest": { "length": 1499.0, "function_hash": "173712037070226086680563938849261185892" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1908e9d01e5395adff68d9d308a0fb15337e6272" }, { "signature_type": "Line", "deprecated": false, "signature_version": "v1", "target": { "file": "fs/btrfs/zoned.c" }, "id": "CVE-2023-52668-d67c06ed", "digest": { "line_hashes": [ "91879074727313826573769376204998762085", "84000855341591983671877521518807400167", "65245607169604202567808808079748061681", "231896596567471076477703895924847845143", "177499630368081451291033984421778436920", "5521406794528135084606950512453595522", "11927629988472011718421457147708612199", "88078714272441640043539319927684943791", "293655380229419112751591223860349709841", "263445997021863635333765660419666484394", "96730790471352947242987445767714601803", "327008510400920750948709853423917029760", "236029329104159607247677601906746568085", "218514079533314104774421144795752363928", "263445997021863635333765660419666484394", "261260303104872113390565692994581687996", "53296694576399635625701331096623753064", "182714396245787086284422099183076885262", "192685896873880626910085634076109647160", "300297107719167794298727648323215409299", "156225988679174593034205730394635791726", "126862545344525427249221841214763690003", "46412602539008031136074189389041870506", "190993188094408341636861831843787802267", "100618956615789216858293467347642253066", "64142205729186306873882340036385802329", "8091997504248942457061597845410380151", "182785554669510067725614616914610994411", "202544923999690700432559031623657482099", "39303256047409121829410337375645733325" ], "threshold": 0.9 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6f74989f5909cdec9b1274641f0fa306b15bb476" } ] }