public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/block/scsi_ioctl.c, Video DVD playback support
@ 2005-01-22  2:27 Elias da Silva
  2005-01-24  8:36 ` Jens Axboe
  0 siblings, 1 reply; 14+ messages in thread
From: Elias da Silva @ 2005-01-22  2:27 UTC (permalink / raw)
  To: Jens Axboe; +Cc: lkml

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

Moin.

Attached patch fixes a problem of reading Video DVDs
through the cdrom_ioctl interface. VMware is among
the prominent victims.

The bug was introduced in kernel version 2.6.8 in the
function verify_command().

Regards,

Elias da Silva

[-- Attachment #2: linux-2.6.10-dvd.patch --]
[-- Type: text/x-diff, Size: 1906 bytes --]

--- linux-2.6.10/drivers/block/scsi_ioctl.c	2004-12-24 22:35:40.000000000 +0100
+++ linux-2.6.10-dvd/drivers/block/scsi_ioctl.c	2005-01-22 02:31:28.223951296 +0100
@@ -159,6 +159,11 @@
 		safe_for_read(GPCMD_SEEK),
 		safe_for_read(GPCMD_STOP_PLAY_SCAN),
 
+                /* Video DVD playback support */
+		safe_for_read(GPCMD_SET_STREAMING),
+		safe_for_read(GPCMD_SEND_KEY),
+                /* safe_for_read(0xe9), missing this opcode definition */
+
 		/* Basic writing commands */
 		safe_for_write(WRITE_6),
 		safe_for_write(WRITE_10),
@@ -179,13 +184,11 @@
 		safe_for_write(GPCMD_RESERVE_RZONE_TRACK),
 		safe_for_write(GPCMD_SEND_DVD_STRUCTURE),
 		safe_for_write(GPCMD_SEND_EVENT),
-		safe_for_write(GPCMD_SEND_KEY),
 		safe_for_write(GPCMD_SEND_OPC),
 		safe_for_write(GPCMD_SEND_CUE_SHEET),
 		safe_for_write(GPCMD_SET_SPEED),
 		safe_for_write(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL),
 		safe_for_write(GPCMD_LOAD_UNLOAD),
-		safe_for_write(GPCMD_SET_STREAMING),
 	};
 	unsigned char type = cmd_type[cmd[0]];
 
@@ -194,13 +197,11 @@
 		return 0;
 
 	/* Write-safe commands just require a writable open.. */
-	if (type & CMD_WRITE_SAFE) {
-		if (file->f_mode & FMODE_WRITE)
-			return 0;
-	}
+	if ((type & CMD_WRITE_SAFE) && (file->f_mode & FMODE_WRITE))
+		return 0;
 
-	if (!(type & CMD_WARNED)) {
-		cmd_type[cmd[0]] = CMD_WARNED;
+	if (!type) {
+		type = cmd_type[cmd[0]] = CMD_WARNED;
 		printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]);
 	}
 
@@ -208,7 +209,14 @@
 	if (capable(CAP_SYS_RAWIO))
 		return 0;
 
-	/* Otherwise fail it with an "Operation not permitted" */
+        if (!(type & CMD_WARNED))
+        {
+          cmd_type[cmd[0]] |= CMD_WARNED;
+          printk(KERN_WARNING "scsi: opcode 0x%02x write/rawio"
+                 " permission denied\n", cmd[0]);
+        }
+
+        /* Otherwise fail it with an "Operation not permitted" */
 	return -EPERM;
 }
 

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-01-25 16:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-22  2:27 [PATCH] drivers/block/scsi_ioctl.c, Video DVD playback support Elias da Silva
2005-01-24  8:36 ` Jens Axboe
2005-01-24 19:59   ` Elias da Silva
2005-01-24 20:39     ` Jens Axboe
2005-01-24 22:10       ` Elias da Silva
2005-01-25  0:01         ` Alan Cox
2005-01-25  8:05           ` Jens Axboe
2005-01-25  9:29           ` Elias da Silva
2005-01-25 12:44             ` Alan Cox
2005-01-25 15:52               ` Elias da Silva
2005-01-25 12:45             ` Jens Axboe
2005-01-25 16:13               ` Elias da Silva
2005-01-25 16:21                 ` Jens Axboe
2005-01-25 16:28                   ` Elias da Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox