block: use jiffies conversion functions in scsi_ioctl.c
PATCH 1/1 block: use jiffies conversion functions in scsi_ioctl.c
Use msecs_to_jiffies() and jiffies_to_msecs() in scsi_ioctl(). Sometimes callers use very large values for e.g. vendor specific media clear command and calculation can overflow.
--- block/scsi_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/scsi_ioctl.c +2 -2
@@ -230,7 +230,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq, rq->cmd_len = hdr->cmd_len; rq->cmd_type =REQ_TYPE_BLOCK_PC ; - rq->timeout = (hdr->timeout *HZ ) /1000 ; + rq->timeout =msecs_to_jiffies (hdr->timeout);if (!rq->timeout) rq->timeout = q->sg_timeout;if (!rq->timeout)
@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q,*/ blk_execute_rq (q, bd_disk, rq,0 ); - hdr->duration = ((jiffies - start_time) *1000 ) /HZ ; + hdr->duration =jiffies_to_msecs (jiffies - start_time);return blk_complete_sghdr_rq (rq, hdr, bio); out:
Quoted 3 lines · Tejun Heo
Use
msecs_to_jiffies()andjiffies_to_msecs()inscsi_ioctl(). Sometimes callers use very large values for e.g. vendor specific media clear command and calculation can overflow.
Thanks Tejun, applied.
Signature · 1 line
Jens Axboe
Quoted 6 lines · Jens Axboe
Quoted 3 lines · Tejun Heo
Use
msecs_to_jiffies()andjiffies_to_msecs()inscsi_ioctl(). Sometimes callers use very large values for e.g. vendor specific media clear command and calculation can overflow.Thanks Tejun, applied.
Jens, it seems premature timeout on bug 9346 could be caused by the same problem. Can you push this so that it can go into 2.6.24?
Signature · 1 line
tejun
Quoted 10 lines · Tejun Heo
Quoted 6 lines · Jens Axboe
Quoted 3 lines · Tejun Heo
Use
msecs_to_jiffies()andjiffies_to_msecs()inscsi_ioctl(). Sometimes callers use very large values for e.g. vendor specific media clear command and calculation can overflow.Thanks Tejun, applied.
Jens, it seems premature timeout on bug 9346 could be caused by the same problem. Can you push this so that it can go into 2.6.24?
Certainly, it'll go in for 2.6.24. I'll push it out today.
Signature · 1 line
Jens Axboe