In the Linux kernel, the following vulnerability has been resolved:
md: fix a crash in mempool_free
There's a crash in mempool_free when running the lvm test shell/lvchange-rebuild-raid.sh.
The reason for the crash is this: * superwritten calls atomicdecandtest(&mddev->pendingwrites) and wakeup(&mddev->sbwait). Then it calls rdevdecpending(rdev, mddev) and bioput(bio). * so, the process that waited on sbwait and that is woken up is racing with bioput(bio). * if the process wins the race, it calls biosetexit before bioput(bio) is executed. * bioput(bio) attempts to free a bio into a destroyed bio set - causing a crash in mempoolfree.
We fix this bug by moving bioput before atomicdecandtest.
We also move rdevdecpending before atomicdecand_test as suggested by Neil Brown.
The function mdendflush has a similar bug - we must call bio_put before we decrement the number of in-progress bios.
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor write access in kernel mode #PF: errorcode(0x0002) - not-present page PGD 11557f0067 P4D 11557f0067 PUD 0 Oops: 0002 [#1] PREEMPT SMP CPU: 0 PID: 73 Comm: kworker/0:1 Not tainted 6.1.0-rc3 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 Workqueue: kdelayd flushexpiredbios [dmdelay] RIP: 0010:mempoolfree+0x47/0x80 Code: 48 89 ef 5b 5d ff e0 f3 c3 48 89 f7 e8 32 45 3f 00 48 63 53 08 48 89 c6 3b 53 04 7d 2d 48 8b 43 10 8d 4a 01 48 89 df 89 4b 08 <48> 89 2c d0 e8 b0 45 3f 00 48 8d 7b 30 5b 5d 31 c9 ba 01 00 00 00 RSP: 0018:ffff88910036bda8 EFLAGS: 00010093 RAX: 0000000000000000 RBX: ffff8891037b65d8 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000202 RDI: ffff8891037b65d8 RBP: ffff8891447ba240 R08: 0000000000012908 R09: 00000000003d0900 R10: 0000000000000000 R11: 0000000000173544 R12: ffff889101a14000 R13: ffff8891562ac300 R14: ffff889102b41440 R15: ffffe8ffffa00d05 FS: 0000000000000000(0000) GS:ffff88942fa00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000001102e99000 CR4: 00000000000006b0 Call Trace: <TASK> cloneendio+0xf4/0x1c0 [dmmod] cloneendio+0xf4/0x1c0 [dmmod] _submitbio+0x76/0x120 submitbionoacctnocheck+0xb6/0x2a0 flushexpiredbios+0x28/0x2f [dmdelay] processonework+0x1b4/0x300 workerthread+0x45/0x3e0 ? rescuerthread+0x380/0x380 kthread+0xc2/0x100 ? kthreadcompleteandexit+0x20/0x20 retfromfork+0x1f/0x30 </TASK> Modules linked in: brd dmdelay dmraid dmmod afpacket uvesafb cfbfillrect cfbimgblt cn cfbcopyarea fb font fbdev tun autofs4 binfmtmisc configfs ipv6 virtiorng virtioballoon rngcore virtionet pcspkr netfailover failover qemufwcfg button mousedev raid10 raid456 libcrc32c asyncraid6recov asyncmemcpy asyncpq raid6pq asyncxor xor asynctx raid1 raid0 mdmod sdmod t10pi crc64rocksoft crc64 virtioscsi scsimod evdev psmouse bsg scsicommon [last unloaded: brd] CR2: 0000000000000000 ---[ end trace 0000000000000000 ]---
[ { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@97ce99984be12b9acb49ddce0f5d8ebb037adbb6", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "super_written" }, "digest": { "length": 594.0, "function_hash": "313693320756053482701124525458309019459" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-0c731181" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5be563b4356b3089b3245d024cae3f248ba7090", "signature_version": "v1", "target": { "file": "drivers/md/md.c" }, "digest": { "line_hashes": [ "118537914582526490410010141154599630642", "283722771071732161764770939442802128377", "30409081419002336234793608877302680525", "232221045526086304313174125929370252415", "254952937537659423663475090418584439243", "321784481835857465242620941805867017615", "253739916433821588864902882227374112436", "51969732498512344772121635659904573494", "283278288020432908098665074431308561792", "93851396111250087516392697707380876627", "192336775990856744601622698060697988395", "29766448809459104584297151697682863383", "167106163336198498983345555701330579661", "254230006172489377493777373988615896359", "211780593091351187487562071809383180221" ], "threshold": 0.9 }, "deprecated": false, "signature_type": "Line", "id": "CVE-2022-50381-0d5c51a3" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@91bd504128a51776472445070e11a3b0f9348c90", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "super_written" }, "digest": { "length": 594.0, "function_hash": "313693320756053482701124525458309019459" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-0e5dde95" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ae7793027766491c5f8635b12d15a5940d3b8698", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "super_written" }, "digest": { "length": 594.0, "function_hash": "313693320756053482701124525458309019459" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-1d67d308" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@91bd504128a51776472445070e11a3b0f9348c90", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "md_end_flush" }, "digest": { "length": 242.0, "function_hash": "103100474583648178424540769640021176038" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-21ddab2f" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5be563b4356b3089b3245d024cae3f248ba7090", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "super_written" }, "digest": { "length": 581.0, "function_hash": "73219779917783526258549743809060856673" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-2754127b" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@341097ee53573e06ab9fc675d96a052385b851fa", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "super_written" }, "digest": { "length": 594.0, "function_hash": "313693320756053482701124525458309019459" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-283bc813" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cf06b162f5b6337b688072a1a47941280b8f7110", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "md_end_flush" }, "digest": { "length": 242.0, "function_hash": "103100474583648178424540769640021176038" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-2dd72b6b" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@97ce99984be12b9acb49ddce0f5d8ebb037adbb6", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "md_end_flush" }, "digest": { "length": 242.0, "function_hash": "103100474583648178424540769640021176038" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-38e2f07c" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@842f222fc42a9239831e15b1fd49a51c546902cb", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "md_end_flush" }, "digest": { "length": 242.0, "function_hash": "103100474583648178424540769640021176038" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-44973eea" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cf06b162f5b6337b688072a1a47941280b8f7110", "signature_version": "v1", "target": { "file": "drivers/md/md.c" }, "digest": { "line_hashes": [ "118537914582526490410010141154599630642", "283722771071732161764770939442802128377", "30409081419002336234793608877302680525", "232221045526086304313174125929370252415", "254952937537659423663475090418584439243", "321784481835857465242620941805867017615", "253739916433821588864902882227374112436", "51969732498512344772121635659904573494", "283278288020432908098665074431308561792", "93851396111250087516392697707380876627", "192336775990856744601622698060697988395", "29766448809459104584297151697682863383", "167106163336198498983345555701330579661", "254230006172489377493777373988615896359", "211780593091351187487562071809383180221" ], "threshold": 0.9 }, "deprecated": false, "signature_type": "Line", "id": "CVE-2022-50381-462767a6" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@91bd504128a51776472445070e11a3b0f9348c90", "signature_version": "v1", "target": { "file": "drivers/md/md.c" }, "digest": { "line_hashes": [ "118537914582526490410010141154599630642", "283722771071732161764770939442802128377", "30409081419002336234793608877302680525", "232221045526086304313174125929370252415", "254952937537659423663475090418584439243", "321784481835857465242620941805867017615", "253739916433821588864902882227374112436", "51969732498512344772121635659904573494", "283278288020432908098665074431308561792", "93851396111250087516392697707380876627", "192336775990856744601622698060697988395", "29766448809459104584297151697682863383", "167106163336198498983345555701330579661", "254230006172489377493777373988615896359", "211780593091351187487562071809383180221" ], "threshold": 0.9 }, "deprecated": false, "signature_type": "Line", "id": "CVE-2022-50381-51d64cbe" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ae7793027766491c5f8635b12d15a5940d3b8698", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "md_end_flush" }, "digest": { "length": 242.0, "function_hash": "103100474583648178424540769640021176038" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-65c238a3" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@842f222fc42a9239831e15b1fd49a51c546902cb", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "super_written" }, "digest": { "length": 594.0, "function_hash": "313693320756053482701124525458309019459" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-782e3917" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5be563b4356b3089b3245d024cae3f248ba7090", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "md_end_flush" }, "digest": { "length": 242.0, "function_hash": "103100474583648178424540769640021176038" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-9a886a6a" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@341097ee53573e06ab9fc675d96a052385b851fa", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "md_end_flush" }, "digest": { "length": 242.0, "function_hash": "103100474583648178424540769640021176038" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-9f161a82" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@97ce99984be12b9acb49ddce0f5d8ebb037adbb6", "signature_version": "v1", "target": { "file": "drivers/md/md.c" }, "digest": { "line_hashes": [ "118537914582526490410010141154599630642", "283722771071732161764770939442802128377", "30409081419002336234793608877302680525", "232221045526086304313174125929370252415", "254952937537659423663475090418584439243", "321784481835857465242620941805867017615", "253739916433821588864902882227374112436", "51969732498512344772121635659904573494", "283278288020432908098665074431308561792", "93851396111250087516392697707380876627", "192336775990856744601622698060697988395", "29766448809459104584297151697682863383", "167106163336198498983345555701330579661", "254230006172489377493777373988615896359", "211780593091351187487562071809383180221" ], "threshold": 0.9 }, "deprecated": false, "signature_type": "Line", "id": "CVE-2022-50381-acfa321f" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ae7793027766491c5f8635b12d15a5940d3b8698", "signature_version": "v1", "target": { "file": "drivers/md/md.c" }, "digest": { "line_hashes": [ "118537914582526490410010141154599630642", "283722771071732161764770939442802128377", "30409081419002336234793608877302680525", "232221045526086304313174125929370252415", "254952937537659423663475090418584439243", "321784481835857465242620941805867017615", "253739916433821588864902882227374112436", "51969732498512344772121635659904573494", "283278288020432908098665074431308561792", "93851396111250087516392697707380876627", "192336775990856744601622698060697988395", "29766448809459104584297151697682863383", "167106163336198498983345555701330579661", "254230006172489377493777373988615896359", "211780593091351187487562071809383180221" ], "threshold": 0.9 }, "deprecated": false, "signature_type": "Line", "id": "CVE-2022-50381-b5751dcc" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@384ef33d37cefb2ac539d44597d03f06c9b8975c", "signature_version": "v1", "target": { "file": "drivers/md/md.c" }, "digest": { "line_hashes": [ "118537914582526490410010141154599630642", "283722771071732161764770939442802128377", "30409081419002336234793608877302680525", "232221045526086304313174125929370252415", "254952937537659423663475090418584439243", "321784481835857465242620941805867017615", "253739916433821588864902882227374112436", "51969732498512344772121635659904573494", "283278288020432908098665074431308561792", "93851396111250087516392697707380876627", "192336775990856744601622698060697988395", "29766448809459104584297151697682863383", "167106163336198498983345555701330579661", "254230006172489377493777373988615896359", "211780593091351187487562071809383180221" ], "threshold": 0.9 }, "deprecated": false, "signature_type": "Line", "id": "CVE-2022-50381-c0858e72" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@384ef33d37cefb2ac539d44597d03f06c9b8975c", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "md_end_flush" }, "digest": { "length": 242.0, "function_hash": "103100474583648178424540769640021176038" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-c89ce850" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@384ef33d37cefb2ac539d44597d03f06c9b8975c", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "super_written" }, "digest": { "length": 581.0, "function_hash": "73219779917783526258549743809060856673" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-d04c55da" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@341097ee53573e06ab9fc675d96a052385b851fa", "signature_version": "v1", "target": { "file": "drivers/md/md.c" }, "digest": { "line_hashes": [ "118537914582526490410010141154599630642", "283722771071732161764770939442802128377", "30409081419002336234793608877302680525", "232221045526086304313174125929370252415", "254952937537659423663475090418584439243", "321784481835857465242620941805867017615", "253739916433821588864902882227374112436", "51969732498512344772121635659904573494", "283278288020432908098665074431308561792", "93851396111250087516392697707380876627", "192336775990856744601622698060697988395", "29766448809459104584297151697682863383", "167106163336198498983345555701330579661", "254230006172489377493777373988615896359", "211780593091351187487562071809383180221" ], "threshold": 0.9 }, "deprecated": false, "signature_type": "Line", "id": "CVE-2022-50381-d63b2d25" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@842f222fc42a9239831e15b1fd49a51c546902cb", "signature_version": "v1", "target": { "file": "drivers/md/md.c" }, "digest": { "line_hashes": [ "118537914582526490410010141154599630642", "283722771071732161764770939442802128377", "30409081419002336234793608877302680525", "232221045526086304313174125929370252415", "254952937537659423663475090418584439243", "321784481835857465242620941805867017615", "253739916433821588864902882227374112436", "51969732498512344772121635659904573494", "283278288020432908098665074431308561792", "93851396111250087516392697707380876627", "192336775990856744601622698060697988395", "29766448809459104584297151697682863383", "167106163336198498983345555701330579661", "254230006172489377493777373988615896359", "211780593091351187487562071809383180221" ], "threshold": 0.9 }, "deprecated": false, "signature_type": "Line", "id": "CVE-2022-50381-ed0fbc36" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cf06b162f5b6337b688072a1a47941280b8f7110", "signature_version": "v1", "target": { "file": "drivers/md/md.c", "function": "super_written" }, "digest": { "length": 581.0, "function_hash": "73219779917783526258549743809060856673" }, "deprecated": false, "signature_type": "Function", "id": "CVE-2022-50381-f72d2283" } ]