[PATCH] change scsi_ioctl to allow cd-recording 2.6.8.1

From: Andreas Messer
Date: Mon Aug 16 2004 - 18:09:43 EST


Hello,

this is my first Email to the kernel-mailing list. I hope i have understand
the howto-post-a-patch the right way.
As burning cd's as user is not possible with 2.6.8.1 without setting cdrecord
setuid root and burning with k3b wont work at all, i decided to change
driver/block/scsi_ioctl.c to allow it again. I allowed the commands listended
in MMC-2 paper. Burning cds with k3b works now fine again, burning dvds
should also work again.

regards
Andreas
--
gnuPG keyid: 0xE94F63B7 fingerprint: D189 D5E3 FF4B 7E24 E49D 7638 07C5 924C
E94F 63B7
--- linux-2.6.8.1/drivers/block/scsi_ioctl.c 2004-08-16 21:44:53.000000000 +0200
+++ linux/drivers/block/scsi_ioctl.c 2004-08-17 00:53:12.000000000 +0200
@@ -156,6 +156,35 @@
safe_for_write(WRITE_16),
safe_for_write(WRITE_BUFFER),
safe_for_write(WRITE_LONG),
+
+ /* Some defs for recording CDs */
+
+ /* obsolete: 0x01 REZERO_UNIT, 0x5c READ_BUFFER */
+ /* used by k3b, but also work without */
+
+
+ safe_for_read(GPCMD_GET_CONFIGURATION),
+ safe_for_read(GPCMD_MODE_SELECT_10), /* read needed by k3b */
+ safe_for_read(GPCMD_SET_SPEED), /* obsolete but often used */
+ safe_for_read(GPCMD_LOAD_UNLOAD),
+
+ safe_for_write(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL),
+ safe_for_write(GPCMD_FLUSH_CACHE),
+ safe_for_write(GPCMD_CLOSE_TRACK),
+ safe_for_write(GPCMD_FORMAT_UNIT),
+ safe_for_write(GPCMD_BLANK),
+ safe_for_write(GPCMD_READ_FORMAT_CAPACITIES),
+ safe_for_write(GPCMD_RESERVE_RZONE_TRACK),
+ safe_for_write(GPCMD_SEND_KEY),
+ safe_for_write(GPCMD_SEND_OPC),
+ safe_for_write(GPCMD_SET_STREAMING),
+
+ /* possibly needed: 0x5d SEND_CUE_SHEET/SEND_EVENT*/
+ /* 0xbf SEND_DVD_STRUCTURE */
+ /* but not defined yet in linux/cdrom.h */
+
+ safe_for_write(0x5d),
+ safe_for_write(0xbf),
};
unsigned char type = cmd_type[cmd[0]];

@@ -173,6 +202,14 @@
if (capable(CAP_SYS_RAWIO))
return 0;

+ /* Added for debugging*/
+
+ if(file->f_mode & FMODE_WRITE)
+ printk(KERN_WARNING "SCSI-CMD Filter: 0x%x not allowed with write-mode\n",cmd[0]);
+ else
+ printk(KERN_WARNING "SCSI-CMD Filter: 0x%x not allowed with read-mode\n",cmd[0]);
+
+
/* Otherwise fail it with an "Operation not permitted" */
return -EPERM;
}
andreas.messer@xxxxxx allows users to record cd's