diff mbox series

[01/24] bsg: remove support for SCSI_IOCTL_SEND_COMMAND

Message ID 20210724072033.1284840-2-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/24] bsg: remove support for SCSI_IOCTL_SEND_COMMAND | expand

Commit Message

hch@lst.de July 24, 2021, 7:20 a.m. UTC
SCSI_IOCTL_SEND_COMMAND has been deprecated longer than bsg exists
and has been warning for just as long.  More importantly it harcodes
SCSI CDBs and thus will do the wrong thing on non-scsi bsg nodes.

Fixes: aa387cc89567 ("block: add bsg helper library")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 block/bsg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jens Axboe July 28, 2021, 1:32 a.m. UTC | #1
On 7/24/21 1:20 AM, Christoph Hellwig wrote:
> SCSI_IOCTL_SEND_COMMAND has been deprecated longer than bsg exists
> and has been warning for just as long.  More importantly it harcodes
> SCSI CDBs and thus will do the wrong thing on non-scsi bsg nodes.

Acked-by: Jens Axboe <axboe@kernel.dk>
Martin K. Petersen July 29, 2021, 3:38 a.m. UTC | #2
On Sat, 24 Jul 2021 09:20:10 +0200, Christoph Hellwig wrote:

> SCSI_IOCTL_SEND_COMMAND has been deprecated longer than bsg exists
> and has been warning for just as long.  More importantly it harcodes
> SCSI CDBs and thus will do the wrong thing on non-scsi bsg nodes.

Applied to 5.15/scsi-queue, thanks!

[01/24] bsg: remove support for SCSI_IOCTL_SEND_COMMAND
        https://git.kernel.org/mkp/scsi/c/beec64d0c974
[02/24] sr: consolidate compat ioctl handling
        https://git.kernel.org/mkp/scsi/c/558e3fbe228a
[03/24] sd: consolidate compat ioctl handling
        https://git.kernel.org/mkp/scsi/c/443283109f5c
[04/24] ch: consolidate compat ioctl handling
        https://git.kernel.org/mkp/scsi/c/bce96675091f
[05/24] cg: consolidate compat ioctl handling
        https://git.kernel.org/mkp/scsi/c/2c2db2c6059a
[06/24] scsi: remove scsi_compat_ioctl
        https://git.kernel.org/mkp/scsi/c/6fade4505af8
[07/24] st: simplify ioctl handling
        https://git.kernel.org/mkp/scsi/c/dba7688fc903
[08/24] cdrom: remove the call to scsi_cmd_blk_ioctl from cdrom_ioctl
        https://git.kernel.org/mkp/scsi/c/e9ee7fea4578
[09/24] scsi_ioctl: remove scsi_cmd_blk_ioctl
        https://git.kernel.org/mkp/scsi/c/fb1ba406c451
[10/24] scsi_ioctl: remove scsi_verify_blk_ioctl
        https://git.kernel.org/mkp/scsi/c/4f07bfc56157
[11/24] scsi: call scsi_cmd_ioctl from scsi_ioctl
        https://git.kernel.org/mkp/scsi/c/2e27f576abc6
[12/24] block: add a queue_max_sectors_bytes helper
        https://git.kernel.org/mkp/scsi/c/547e2f7093b1
[13/24] bsg: decouple from scsi_cmd_ioctl
        https://git.kernel.org/mkp/scsi/c/d52fe8f436a6
[14/24] bsg: move bsg_scsi_ops to drivers/scsi/
        https://git.kernel.org/mkp/scsi/c/78011042684d
[15/24] scsi_ioctl: remove scsi_req_init
        https://git.kernel.org/mkp/scsi/c/2cece3778475
[16/24] scsi_ioctl: move scsi_command_size_tbl to scsi_common.c
        https://git.kernel.org/mkp/scsi/c/b69367dffd86
[17/24] scsi_ioctl: simplify SCSI passthrough permission checking
        https://git.kernel.org/mkp/scsi/c/7353dc06c9a8
[18/24] scsi_ioctl: move the "block layer" SCSI ioctl handling to drivers/scsi
        https://git.kernel.org/mkp/scsi/c/f2542a3be327
[19/24] scsi: rename CONFIG_BLK_SCSI_REQUEST to CONFIG_SCSI_COMMON
        https://git.kernel.org/mkp/scsi/c/33ff4ce45b12
[20/24] scsi: remove a very misleading comment
        https://git.kernel.org/mkp/scsi/c/a9705477f552
[21/24] scsi: consolidate the START STOP UNIT handling
        https://git.kernel.org/mkp/scsi/c/514761874350
[22/24] scsi: factor SCSI_IOCTL_GET_IDLUN handling into a helper
        https://git.kernel.org/mkp/scsi/c/2102a5cc1233
[23/24] scsi: factor SG_IO handling into a helper
        https://git.kernel.org/mkp/scsi/c/b2123d3b0987
[24/24] scsi: unexport sg_scsi_ioctl
        https://git.kernel.org/mkp/scsi/c/08dc2f9b53af
diff mbox series

Patch

diff --git a/block/bsg.c b/block/bsg.c
index 1f196563ae6c..79b42c5cafeb 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -373,10 +373,13 @@  static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	case SG_GET_RESERVED_SIZE:
 	case SG_SET_RESERVED_SIZE:
 	case SG_EMULATED_HOST:
-	case SCSI_IOCTL_SEND_COMMAND:
 		return scsi_cmd_ioctl(bd->queue, NULL, file->f_mode, cmd, uarg);
 	case SG_IO:
 		return bsg_sg_io(bd->queue, file->f_mode, uarg);
+	case SCSI_IOCTL_SEND_COMMAND:
+		pr_warn_ratelimited("%s: calling unsupported SCSI_IOCTL_SEND_COMMAND\n",
+				current->comm);
+		return -EINVAL;
 	default:
 		return -ENOTTY;
 	}