diff mbox series

scsi: sr: fix typo in CDROM(CLOSETRAY|EJECT) handling

Message ID 20220323002242.21157-1-kgroeneveld@lenbrook.com (mailing list archive)
State Accepted
Headers show
Series scsi: sr: fix typo in CDROM(CLOSETRAY|EJECT) handling | expand

Commit Message

Kevin Groeneveld March 23, 2022, 12:22 a.m. UTC
Commit 2e27f576abc6 ("scsi: scsi_ioctl: Call scsi_cmd_ioctl() from
scsi_ioctl()") seems to have a typo as it is checking ret instead of
cmd in the if statement checking for CDROMCLOSETRAY and CDROMEJECT.
This changes the behaviour of these ioctls as the cdrom_ioctl
handling of these is more restrictive than the scsi_ioctl version.

Fixes: 2e27f576abc6 ("scsi: scsi_ioctl: Call scsi_cmd_ioctl() from scsi_ioctl()")
Signed-off-by: Kevin Groeneveld <kgroeneveld@lenbrook.com>
---
 drivers/scsi/sr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig March 23, 2022, 6:36 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Martin K. Petersen March 30, 2022, 3:38 a.m. UTC | #2
Kevin,

> Commit 2e27f576abc6 ("scsi: scsi_ioctl: Call scsi_cmd_ioctl() from
> scsi_ioctl()") seems to have a typo as it is checking ret instead of
> cmd in the if statement checking for CDROMCLOSETRAY and CDROMEJECT.
> This changes the behaviour of these ioctls as the cdrom_ioctl handling
> of these is more restrictive than the scsi_ioctl version.

Applied to 5.18/scsi-staging, thanks!
Martin K. Petersen April 7, 2022, 1:35 p.m. UTC | #3
On Tue, 22 Mar 2022 20:22:42 -0400, Kevin Groeneveld wrote:

> Commit 2e27f576abc6 ("scsi: scsi_ioctl: Call scsi_cmd_ioctl() from
> scsi_ioctl()") seems to have a typo as it is checking ret instead of
> cmd in the if statement checking for CDROMCLOSETRAY and CDROMEJECT.
> This changes the behaviour of these ioctls as the cdrom_ioctl
> handling of these is more restrictive than the scsi_ioctl version.
> 
> 
> [...]

Applied to 5.18/scsi-fixes, thanks!

[1/1] scsi: sr: fix typo in CDROM(CLOSETRAY|EJECT) handling
      https://git.kernel.org/mkp/scsi/c/bc5519c18a32
diff mbox series

Patch

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index f925b1f1f9ad..a0beb11abdc9 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -578,7 +578,7 @@  static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
 
 	scsi_autopm_get_device(sdev);
 
-	if (ret != CDROMCLOSETRAY && ret != CDROMEJECT) {
+	if (cmd != CDROMCLOSETRAY && cmd != CDROMEJECT) {
 		ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg);
 		if (ret != -ENOSYS)
 			goto put;