Commit 914e1708 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'block-6.8-2024-01-26' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

 - RCU warning fix for md (Mikulas)

 - Fix for an aoe issue that lockdep rightfully complained about
   (Maksim)

 - Fix for an error code change in partitioning that caused a regression
   with some tools (Li)

 - Fix for a data direction warning with bi-direction commands
   (Christian)

* tag 'block-6.8-2024-01-26' of git://git.kernel.dk/linux:
  md: fix a suspicious RCU usage warning
  aoe: avoid potential deadlock at set_capacity
  block: Fix WARNING in _copy_from_iter
  block: Move checking GENHD_FL_NO_PART to bdev_add_partition()
parents cced1c5e 5af2c3f4
...@@ -205,12 +205,19 @@ static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data, ...@@ -205,12 +205,19 @@ static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data,
/* /*
* success * success
*/ */
if ((iov_iter_rw(iter) == WRITE && if (iov_iter_rw(iter) == WRITE &&
(!map_data || !map_data->null_mapped)) || (!map_data || !map_data->null_mapped)) {
(map_data && map_data->from_user)) {
ret = bio_copy_from_iter(bio, iter); ret = bio_copy_from_iter(bio, iter);
if (ret) if (ret)
goto cleanup; goto cleanup;
} else if (map_data && map_data->from_user) {
struct iov_iter iter2 = *iter;
/* This is the copy-in part of SG_DXFER_TO_FROM_DEV. */
iter2.data_source = ITER_SOURCE;
ret = bio_copy_from_iter(bio, &iter2);
if (ret)
goto cleanup;
} else { } else {
if (bmd->is_our_pages) if (bmd->is_our_pages)
zero_fill_bio(bio); zero_fill_bio(bio);
......
...@@ -20,8 +20,6 @@ static int blkpg_do_ioctl(struct block_device *bdev, ...@@ -20,8 +20,6 @@ static int blkpg_do_ioctl(struct block_device *bdev,
struct blkpg_partition p; struct blkpg_partition p;
sector_t start, length; sector_t start, length;
if (disk->flags & GENHD_FL_NO_PART)
return -EINVAL;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
if (copy_from_user(&p, upart, sizeof(struct blkpg_partition))) if (copy_from_user(&p, upart, sizeof(struct blkpg_partition)))
......
...@@ -439,6 +439,11 @@ int bdev_add_partition(struct gendisk *disk, int partno, sector_t start, ...@@ -439,6 +439,11 @@ int bdev_add_partition(struct gendisk *disk, int partno, sector_t start,
goto out; goto out;
} }
if (disk->flags & GENHD_FL_NO_PART) {
ret = -EINVAL;
goto out;
}
if (partition_overlaps(disk, start, length, -1)) { if (partition_overlaps(disk, start, length, -1)) {
ret = -EBUSY; ret = -EBUSY;
goto out; goto out;
......
...@@ -333,6 +333,7 @@ aoeblk_gdalloc(void *vp) ...@@ -333,6 +333,7 @@ aoeblk_gdalloc(void *vp)
struct gendisk *gd; struct gendisk *gd;
mempool_t *mp; mempool_t *mp;
struct blk_mq_tag_set *set; struct blk_mq_tag_set *set;
sector_t ssize;
ulong flags; ulong flags;
int late = 0; int late = 0;
int err; int err;
...@@ -396,7 +397,7 @@ aoeblk_gdalloc(void *vp) ...@@ -396,7 +397,7 @@ aoeblk_gdalloc(void *vp)
gd->minors = AOE_PARTITIONS; gd->minors = AOE_PARTITIONS;
gd->fops = &aoe_bdops; gd->fops = &aoe_bdops;
gd->private_data = d; gd->private_data = d;
set_capacity(gd, d->ssize); ssize = d->ssize;
snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d", snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d",
d->aoemajor, d->aoeminor); d->aoemajor, d->aoeminor);
...@@ -405,6 +406,8 @@ aoeblk_gdalloc(void *vp) ...@@ -405,6 +406,8 @@ aoeblk_gdalloc(void *vp)
spin_unlock_irqrestore(&d->lock, flags); spin_unlock_irqrestore(&d->lock, flags);
set_capacity(gd, ssize);
err = device_add_disk(NULL, gd, aoe_attr_groups); err = device_add_disk(NULL, gd, aoe_attr_groups);
if (err) if (err)
goto out_disk_cleanup; goto out_disk_cleanup;
......
...@@ -2262,7 +2262,7 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio) ...@@ -2262,7 +2262,7 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio)
int sectors = r1_bio->sectors; int sectors = r1_bio->sectors;
int read_disk = r1_bio->read_disk; int read_disk = r1_bio->read_disk;
struct mddev *mddev = conf->mddev; struct mddev *mddev = conf->mddev;
struct md_rdev *rdev = rcu_dereference(conf->mirrors[read_disk].rdev); struct md_rdev *rdev = conf->mirrors[read_disk].rdev;
if (exceed_read_errors(mddev, rdev)) { if (exceed_read_errors(mddev, rdev)) {
r1_bio->bios[r1_bio->read_disk] = IO_BLOCKED; r1_bio->bios[r1_bio->read_disk] = IO_BLOCKED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment