lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240705115127.3417539-6-john.g.garry@oracle.com>
Date: Fri,  5 Jul 2024 11:51:27 +0000
From: John Garry <john.g.garry@...cle.com>
To: axboe@...nel.dk, mst@...hat.com, jasowang@...hat.com,
        xuanzhuo@...ux.alibaba.com, eperezma@...hat.com, pbonzini@...hat.com,
        stefanha@...hat.com, hare@...e.de, kbusch@...nel.org, hch@....de
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        virtualization@...ts.linux.dev, John Garry <john.g.garry@...cle.com>
Subject: [PATCH 5/5] loop: Don't bother validating blocksize

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.

Signed-off-by: John Garry <john.g.garry@...cle.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ