Skip to content

Commit 40f879b

Browse files
committed
Merge tag 'block-6.3-2023-03-09' of git://git.kernel.dk/linux
Pull block fixes from Jens Axboe: - Fix a regression in exclusive mode handling of the partition code, introduced in this merge windoe (Yu) - Fix for a use-after-free in BFQ (Yu) - Add sysfs documentation for the 'hidden' attribute (Sagi) * tag 'block-6.3-2023-03-09' of git://git.kernel.dk/linux: block, bfq: fix uaf for 'stable_merge_bfqq' docs: sysfs-block: document hidden sysfs entry block: fix wrong mode for blkdev_put() from disk_scan_partitions()
2 parents d33d4c9 + e2f2a39 commit 40f879b

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

Documentation/ABI/stable/sysfs-block

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,15 @@ Description:
705705
zoned will report "none".
706706

707707

708+
What: /sys/block/<disk>/hidden
709+
Date: March 2023
710+
711+
Description:
712+
[RO] the block device is hidden. it doesn’t produce events, and
713+
can’t be opened from userspace or using blkdev_get*.
714+
Used for the underlying components of multipath devices.
715+
716+
708717
What: /sys/block/<disk>/stat
709718
Date: February 2008
710719
Contact: Jerome Marchand <[email protected]>

block/bfq-iosched.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,11 +2854,11 @@ bfq_setup_stable_merge(struct bfq_data *bfqd, struct bfq_queue *bfqq,
28542854
{
28552855
int proc_ref = min(bfqq_process_refs(bfqq),
28562856
bfqq_process_refs(stable_merge_bfqq));
2857-
struct bfq_queue *new_bfqq;
2857+
struct bfq_queue *new_bfqq = NULL;
28582858

2859-
if (idling_boosts_thr_without_issues(bfqd, bfqq) ||
2860-
proc_ref == 0)
2861-
return NULL;
2859+
bfqq_data->stable_merge_bfqq = NULL;
2860+
if (idling_boosts_thr_without_issues(bfqd, bfqq) || proc_ref == 0)
2861+
goto out;
28622862

28632863
/* next function will take at least one ref */
28642864
new_bfqq = bfq_setup_merge(bfqq, stable_merge_bfqq);
@@ -2873,6 +2873,11 @@ bfq_setup_stable_merge(struct bfq_data *bfqd, struct bfq_queue *bfqq,
28732873
new_bfqq_data->stably_merged = true;
28742874
}
28752875
}
2876+
2877+
out:
2878+
/* deschedule stable merge, because done or aborted here */
2879+
bfq_put_stable_ref(stable_merge_bfqq);
2880+
28762881
return new_bfqq;
28772882
}
28782883

@@ -2933,11 +2938,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq,
29332938
struct bfq_queue *stable_merge_bfqq =
29342939
bfqq_data->stable_merge_bfqq;
29352940

2936-
/* deschedule stable merge, because done or aborted here */
2937-
bfq_put_stable_ref(stable_merge_bfqq);
2938-
2939-
bfqq_data->stable_merge_bfqq = NULL;
2940-
29412941
return bfq_setup_stable_merge(bfqd, bfqq,
29422942
stable_merge_bfqq,
29432943
bfqq_data);

block/genhd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ int disk_scan_partitions(struct gendisk *disk, fmode_t mode)
385385
if (IS_ERR(bdev))
386386
ret = PTR_ERR(bdev);
387387
else
388-
blkdev_put(bdev, mode);
388+
blkdev_put(bdev, mode & ~FMODE_EXCL);
389389

390390
if (!(mode & FMODE_EXCL))
391391
bd_abort_claiming(disk->part0, disk_scan_partitions);

0 commit comments

Comments
 (0)