From: John Garry <john.g.garry@oracle.com>
To: axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com,
xuanzhuo@linux.alibaba.com, eperezma@redhat.com,
pbonzini@redhat.com, stefanha@redhat.com, hare@suse.de,
kbusch@kernel.org, hch@lst.de
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux.dev,
John Garry <john.g.garry@oracle.com>
Subject: [PATCH v2 5/5] loop: Don't bother validating blocksize
Date: Mon, 8 Jul 2024 09:16:51 +0000 [thread overview]
Message-ID: <20240708091651.177447-6-john.g.garry@oracle.com> (raw)
In-Reply-To: <20240708091651.177447-1-john.g.garry@oracle.com>
The block queue limits validation does this for us now.
The loop_configure() -> WARN_ON_ONCE() call is dropped, as an invalid
block size would trigger this now. We don't want userspace to be able to
directly trigger WARNs.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
drivers/block/loop.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 1580327dbc1e..736467dc3ca7 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1061,12 +1061,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
goto out_unlock;
}
- if (config->block_size) {
- error = blk_validate_block_size(config->block_size);
- if (error)
- goto out_unlock;
- }
-
error = loop_set_status_from_info(lo, &config->info);
if (error)
goto out_unlock;
@@ -1098,7 +1092,7 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
error = loop_reconfigure_limits(lo, config->block_size);
- if (WARN_ON_ONCE(error))
+ if (error)
goto out_unlock;
loop_update_dio(lo);
@@ -1470,10 +1464,6 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
if (lo->lo_state != Lo_bound)
return -ENXIO;
- err = blk_validate_block_size(arg);
- if (err)
- return err;
-
if (lo->lo_queue->limits.logical_block_size == arg)
return 0;
--
2.31.1
next prev parent reply other threads:[~2024-07-08 9:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 9:16 [PATCH v2 0/5] Validate logical block size in blk_validate_limits() John Garry
2024-07-08 9:16 ` [PATCH v2 1/5] virtio_blk: Fix default logical block size fallback John Garry
2024-07-08 9:16 ` [PATCH v2 2/5] block: Validate logical block size in blk_validate_limits() John Garry
2024-07-09 5:38 ` Damien Le Moal
2024-07-08 9:16 ` [PATCH v2 3/5] null_blk: Don't bother validating blocksize John Garry
2024-07-09 0:12 ` Zhu Yanjun
2024-07-09 5:39 ` Damien Le Moal
2024-07-08 9:16 ` [PATCH v2 4/5] virtio_blk: " John Garry
2024-07-09 5:39 ` Damien Le Moal
2024-07-08 9:16 ` John Garry [this message]
2024-07-09 5:39 ` [PATCH v2 5/5] loop: " Damien Le Moal
2024-07-09 6:01 ` [PATCH v2 0/5] Validate logical block size in blk_validate_limits() Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240708091651.177447-6-john.g.garry@oracle.com \
--to=john.g.garry@oracle.com \
--cc=axboe@kernel.dk \
--cc=eperezma@redhat.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jasowang@redhat.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®