LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Fix for K3B issue (kernel patch) (https://www.linuxquestions.org/questions/linux-software-2/fix-for-k3b-issue-kernel-patch-298025/)

cb9fl 03-05-2005 01:46 PM

Fix for K3B issue (kernel patch)
 
I found the following after searching for a while to fix a problem I was having with k3b. Can someone take a look at this and tell me what you think?

Hello,

I use K3B with growisofs to burn DVDs. After boot I can burn a DVD as a
normal user. But only the first one. When I want to burn another one,
K3B complains that it is unable to prevent media removal. Then only root
can burn DVDs.
The bug is in the kernel in the function verify_command.
When a process opens the DVD recorder with O_RDONLY and issues a command
which is marked safe_for_write, this function is supposed to just return
-EPERM and do nothing more. However, there is a bug that causes the
command to be marked as CMD_WARNED. From now on no non-privileged
process is able to issue this command even if it correctly opens the
device with O_RDWR - because the command is no longer marked as
CMD_WRITE_SAFE.
A patch is attached.

Michal

["verify_command.patch" (text/x-patch)]

--- linux-2.6.11-mm1/drivers/block/scsi_ioctl.c.orig 2005-01-17 20:42:40.000000000 +0100
+++ linux-2.6.11-mm1/drivers/block/scsi_ioctl.c 2005-01-17 20:43:14.000000000 +0100
@@ -197,9 +197,7 @@ static int verify_command(struct file *f
if (type & CMD_WRITE_SAFE) {
if (file->f_mode & FMODE_WRITE)
return 0;
- }
-
- if (!(type & CMD_WARNED)) {
+ } else if (!(type & CMD_WARNED)) {
cmd_type[cmd[0]] = CMD_WARNED;
printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]);
}

jtshaw 03-06-2005 10:54 PM

That seams reasonable to me so long as it's not valid to have CMD_WRITE_SAFE and CMD_WARNED states simultaneously. Unfortunately I don' t know enough about that particular functionality to know if that makes sense or not.

cb9fl 03-07-2005 03:06 PM

I'm having the exact problem described by the post I found. I just wanted to see if anyone else had the same problem or if anyone knew if this would bugger my kernel.


All times are GMT -5. The time now is 11:44 AM.