All of lore.kernel.org
 help / color / mirror / Atom feed
* Incorrect timeout in CDROM_SEND_PACKET ioctl in 2.5 kernels
@ 2003-07-13 16:12 Peter Osterlund
  2003-07-15 14:01 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Osterlund @ 2003-07-13 16:12 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Kernel Mailing List

The CDROM_SEND_PACKET ioctl passes a struct cdrom_generic_command from
user space, which contains a timeout field. The timeout is measured in
jiffies, but the conversion from user to kernel jiffies is missing,
which makes the timeout 10 times shorter than it should be in 2.5
kernels on x86. This causes CDRW formatting with cdrwtool to fail. The
following patch fixes this problem.

--- linux/drivers/cdrom/cdrom.c.old	Sun Jul 13 16:34:37 2003
+++ linux/drivers/cdrom/cdrom.c	Sun Jul 13 15:19:11 2003
@@ -295,6 +295,8 @@
 #define cdinfo(type, fmt, args...) 
 #endif
 
+#define MULDIV(X,MUL,DIV) ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL))
+
 /* These are used to simplify getting data in from and back to user land */
 #define IOCTL_IN(arg, type, in)					\
 	if (copy_from_user(&(in), (type *) (arg), sizeof (in)))	\
@@ -2171,6 +2173,7 @@
 			return -ENOSYS;
 		cdinfo(CD_DO_IOCTL, "entering CDROM_SEND_PACKET\n"); 
 		IOCTL_IN(arg, struct cdrom_generic_command, cgc);
+		cgc.timeout = MULDIV(cgc.timeout, HZ, USER_HZ);
 		return cdrom_do_cmd(cdi, &cgc);
 		}
 	case CDROM_NEXT_WRITABLE: {

-- 
Peter Osterlund - petero2@telia.com
http://w1.894.telia.com/~u89404340

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

* Re: Incorrect timeout in CDROM_SEND_PACKET ioctl in 2.5 kernels
  2003-07-13 16:12 Incorrect timeout in CDROM_SEND_PACKET ioctl in 2.5 kernels Peter Osterlund
@ 2003-07-15 14:01 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2003-07-15 14:01 UTC (permalink / raw)
  To: Peter Osterlund; +Cc: Kernel Mailing List

On Sun, Jul 13 2003, Peter Osterlund wrote:
> The CDROM_SEND_PACKET ioctl passes a struct cdrom_generic_command from
> user space, which contains a timeout field. The timeout is measured in
> jiffies, but the conversion from user to kernel jiffies is missing,
> which makes the timeout 10 times shorter than it should be in 2.5
> kernels on x86. This causes CDRW formatting with cdrwtool to fail. The
> following patch fixes this problem.

Looks fine, applied.

-- 
Jens Axboe


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

end of thread, other threads:[~2003-07-15 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-13 16:12 Incorrect timeout in CDROM_SEND_PACKET ioctl in 2.5 kernels Peter Osterlund
2003-07-15 14:01 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.