Skip to content

Commit

Permalink
Merge tag 'block-6.3-2023-03-09' of git://git.kernel.dk/linux
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
torvalds committed Mar 11, 2023
2 parents d33d4c9 + e2f2a39 commit 40f879b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
9 changes: 9 additions & 0 deletions Documentation/ABI/stable/sysfs-block
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,15 @@ Description:
zoned will report "none".


What: /sys/block/<disk>/hidden
Date: March 2023
Contact: linux-block@vger.kernel.org
Description:
[RO] the block device is hidden. it doesn’t produce events, and
can’t be opened from userspace or using blkdev_get*.
Used for the underlying components of multipath devices.


What: /sys/block/<disk>/stat
Date: February 2008
Contact: Jerome Marchand <jmarchan@redhat.com>
Expand Down
18 changes: 9 additions & 9 deletions block/bfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -2854,11 +2854,11 @@ bfq_setup_stable_merge(struct bfq_data *bfqd, struct bfq_queue *bfqq,
{
int proc_ref = min(bfqq_process_refs(bfqq),
bfqq_process_refs(stable_merge_bfqq));
struct bfq_queue *new_bfqq;
struct bfq_queue *new_bfqq = NULL;

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

/* next function will take at least one ref */
new_bfqq = bfq_setup_merge(bfqq, stable_merge_bfqq);
Expand All @@ -2873,6 +2873,11 @@ bfq_setup_stable_merge(struct bfq_data *bfqd, struct bfq_queue *bfqq,
new_bfqq_data->stably_merged = true;
}
}

out:
/* deschedule stable merge, because done or aborted here */
bfq_put_stable_ref(stable_merge_bfqq);

return new_bfqq;
}

Expand Down Expand Up @@ -2933,11 +2938,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq,
struct bfq_queue *stable_merge_bfqq =
bfqq_data->stable_merge_bfqq;

/* deschedule stable merge, because done or aborted here */
bfq_put_stable_ref(stable_merge_bfqq);

bfqq_data->stable_merge_bfqq = NULL;

return bfq_setup_stable_merge(bfqd, bfqq,
stable_merge_bfqq,
bfqq_data);
Expand Down
2 changes: 1 addition & 1 deletion block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ int disk_scan_partitions(struct gendisk *disk, fmode_t mode)
if (IS_ERR(bdev))
ret = PTR_ERR(bdev);
else
blkdev_put(bdev, mode);
blkdev_put(bdev, mode & ~FMODE_EXCL);

if (!(mode & FMODE_EXCL))
bd_abort_claiming(disk->part0, disk_scan_partitions);
Expand Down

0 comments on commit 40f879b

Please sign in to comment.