Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] Fix SG_IO timeout jiffy conversion

Commit 85e04e371b5a321b5df2bc3f8e0099a64fb087d7 cleaned up the timeout
conversion, but did it exactly the wrong way. We get msecs from user
space, and should convert them into jiffies. Not the other way around.

Here is a fix with the overflow check sg.c has added in. This fixes DVD
burnign with Nero.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
[ "you'll be wanting a comma there" - Andrew ]
Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mike Christie and committed by
Linus Torvalds
c0d4d573 87df7241

+3 -2
+3 -2
block/scsi_ioctl.c
··· 223 223 static int sg_io(struct file *file, request_queue_t *q, 224 224 struct gendisk *bd_disk, struct sg_io_hdr *hdr) 225 225 { 226 - unsigned long start_time; 226 + unsigned long start_time, timeout; 227 227 int writing = 0, ret = 0; 228 228 struct request *rq; 229 229 char sense[SCSI_SENSE_BUFFERSIZE]; ··· 271 271 272 272 rq->cmd_type = REQ_TYPE_BLOCK_PC; 273 273 274 - rq->timeout = jiffies_to_msecs(hdr->timeout); 274 + timeout = msecs_to_jiffies(hdr->timeout); 275 + rq->timeout = (timeout < INT_MAX) ? timeout : INT_MAX; 275 276 if (!rq->timeout) 276 277 rq->timeout = q->sg_timeout; 277 278 if (!rq->timeout)