Skip to content

Commit c0d4d57

Browse files
Mike ChristieLinus Torvalds
authored andcommitted
[PATCH] Fix SG_IO timeout jiffy conversion
Commit 85e04e3 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>
1 parent 87df724 commit c0d4d57

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎block/scsi_ioctl.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static int verify_command(struct file *file, unsigned char *cmd)
223223
static int sg_io(struct file *file, request_queue_t *q,
224224
struct gendisk *bd_disk, struct sg_io_hdr *hdr)
225225
{
226-
unsigned long start_time;
226+
unsigned long start_time, timeout;
227227
int writing = 0, ret = 0;
228228
struct request *rq;
229229
char sense[SCSI_SENSE_BUFFERSIZE];
@@ -271,7 +271,8 @@ static int sg_io(struct file *file, request_queue_t *q,
271271

272272
rq->cmd_type = REQ_TYPE_BLOCK_PC;
273273

274-
rq->timeout = jiffies_to_msecs(hdr->timeout);
274+
timeout = msecs_to_jiffies(hdr->timeout);
275+
rq->timeout = (timeout < INT_MAX) ? timeout : INT_MAX;
275276
if (!rq->timeout)
276277
rq->timeout = q->sg_timeout;
277278
if (!rq->timeout)

0 commit comments

Comments
 (0)