Skip to content

Commit 301d58c

Browse files
committed
Merge branch 'block-6.17' into for-next
* block-6.17: block: ensure discard_granularity is zero when discard is not supported zloop: fix KASAN use-after-free of tag set block: Fix default IO priority if there is no IO context
2 parents 43213b2 + fad6551 commit 301d58c

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

block/blk-settings.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,19 @@ int blk_validate_limits(struct queue_limits *lim)
400400
lim->max_discard_sectors =
401401
min(lim->max_hw_discard_sectors, lim->max_user_discard_sectors);
402402

403+
/*
404+
* When discard is not supported, discard_granularity should be reported
405+
* as 0 to userspace.
406+
*/
407+
if (lim->max_discard_sectors)
408+
lim->discard_granularity =
409+
max(lim->discard_granularity, lim->physical_block_size);
410+
else
411+
lim->discard_granularity = 0;
412+
403413
if (!lim->max_discard_segments)
404414
lim->max_discard_segments = 1;
405415

406-
if (lim->discard_granularity < lim->physical_block_size)
407-
lim->discard_granularity = lim->physical_block_size;
408-
409416
/*
410417
* By default there is no limit on the segment boundary alignment,
411418
* but if there is one it can't be smaller than the page size as

drivers/block/zloop.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ static void zloop_free_disk(struct gendisk *disk)
700700
struct zloop_device *zlo = disk->private_data;
701701
unsigned int i;
702702

703+
blk_mq_free_tag_set(&zlo->tag_set);
704+
703705
for (i = 0; i < zlo->nr_zones; i++) {
704706
struct zloop_zone *zone = &zlo->zones[i];
705707

@@ -1080,7 +1082,6 @@ static int zloop_ctl_remove(struct zloop_options *opts)
10801082

10811083
del_gendisk(zlo->disk);
10821084
put_disk(zlo->disk);
1083-
blk_mq_free_tag_set(&zlo->tag_set);
10841085

10851086
pr_info("Removed device %d\n", opts->id);
10861087

include/linux/ioprio.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ static inline int __get_task_ioprio(struct task_struct *p)
6060
int prio;
6161

6262
if (!ioc)
63-
return IOPRIO_DEFAULT;
63+
return IOPRIO_PRIO_VALUE(task_nice_ioclass(p),
64+
task_nice_ioprio(p));
6465

6566
if (p != current)
6667
lockdep_assert_held(&p->alloc_lock);

0 commit comments

Comments
 (0)