History

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()

Linus Torvalds committed 3 years ago

Commit 40f879b2 parents d33d4c9 e2f2a393 files · +19 −10Browse files

Unified · Split

3 files
  1. Documentation/ABI/stable/sysfs-block +9 −0
  2. block/bfq-iosched.c +9 −9
  3. block/genhd.c +1 −1
Documentation/ABI/stable/sysfs-block+9−0
@@ -705,6 +705,15 @@ Description: · 704 unmodified lines
705705 zoned will report "none".
706706
707707
708+What: /sys/block/<disk>/hidden
709+Date: March 2023
710+Contact: linux-block@vger.kernel.org
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 <jmarchan@redhat.com>
block/bfq-iosched.c+9−9
@@ -2854,11 +2854,11 @@ bfq_setup_stable_merge(struct bfq_data *bfqd, struct bfq_queue *bfqq, · 2853 unmodified lines
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, · 8 unmodified lines
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, · 54 unmodified lines
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+1−1
@@ -385,7 +385,7 @@ int disk_scan_partitions(struct gendisk *disk, fmode_t mode) · 384 unmodified lines
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);