Commit 08fc1ab
block: fix locking in bdev_del_partition
We need to hold the whole device bd_mutex to protect against
other thread concurrently deleting out partition before we get
to it, and thus causing a use after free.
Fixes: cddae80 ("block: pass a hd_struct to delete_partition")
Reported-by: syzbot+6448f3c229bc52b82f69@syzkaller.appspotmail.com
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent cafe01e commit 08fc1ab
1 file changed
Lines changed: 13 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
| 535 | + | |
| 536 | + | |
541 | 537 | | |
542 | | - | |
543 | | - | |
| 538 | + | |
544 | 539 | | |
545 | | - | |
| 540 | + | |
546 | 541 | | |
547 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
548 | 549 | | |
549 | 550 | | |
550 | 551 | | |
| |||
553 | 554 | | |
554 | 555 | | |
555 | 556 | | |
556 | | - | |
557 | 557 | | |
558 | | - | |
559 | | - | |
560 | 558 | | |
561 | 559 | | |
| 560 | + | |
562 | 561 | | |
563 | 562 | | |
564 | | - | |
565 | | - | |
| 563 | + | |
| 564 | + | |
566 | 565 | | |
567 | 566 | | |
568 | 567 | | |
| |||
0 commit comments