Skip to content

Commit

Permalink
[PATCH] Fix SG_IO timeout jiffy conversion
Browse files Browse the repository at this point in the history
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 <[email protected]>
[ "you'll be wanting a comma there" - Andrew ]
Cc: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Mike Christie authored and Linus Torvalds committed Jan 30, 2007
1 parent 87df724 commit c0d4d57
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions block/scsi_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ static int verify_command(struct file *file, unsigned char *cmd)
static int sg_io(struct file *file, request_queue_t *q,
struct gendisk *bd_disk, struct sg_io_hdr *hdr)
{
unsigned long start_time;
unsigned long start_time, timeout;
int writing = 0, ret = 0;
struct request *rq;
char sense[SCSI_SENSE_BUFFERSIZE];
Expand Down Expand Up @@ -271,7 +271,8 @@ static int sg_io(struct file *file, request_queue_t *q,

rq->cmd_type = REQ_TYPE_BLOCK_PC;

rq->timeout = jiffies_to_msecs(hdr->timeout);
timeout = msecs_to_jiffies(hdr->timeout);
rq->timeout = (timeout < INT_MAX) ? timeout : INT_MAX;
if (!rq->timeout)
rq->timeout = q->sg_timeout;
if (!rq->timeout)
Expand Down

0 comments on commit c0d4d57

Please sign in to comment.