Re: 2.6.20-rc6: known unfixed regressions (v2) (part 2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2007-01-29 at 19:08 -0800, Andrew Morton wrote:
> On Mon, 29 Jan 2007 20:50:58 -0600
> Mike Christie <michaelc@xxxxxxxxxxx> wrote:
> 
> > With the attached patch, nero finds the cd drives and I can burn disks.
> > There is no errors from the ide layer like before.
> > 
> > 
> > [use-old-timeout-calc.patch  text/x-patch (399B)]
> > diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
> > index 2528a0c..aded9a0 100644
> > --- a/block/scsi_ioctl.c
> > +++ b/block/scsi_ioctl.c
> > @@ -271,7 +271,7 @@ static int sg_io(struct file *file, requ
> >  
> >  	rq->cmd_type = REQ_TYPE_BLOCK_PC;
> >  
> > -	rq->timeout = jiffies_to_msecs(hdr->timeout);
> > +	rq->timeout = (hdr->timeout * HZ) / 1000;
> 
> Yes, that was a buggy conversion - it should have been msecs_to_jiffies().

Ok. here is a fix with the overflow check sg.c has. Patch
was made against Linus's tree and tested with nero.

Userspace does not send us jiffies. Use msecs_to_jiffies
and check for overflow like sg.c

Signed-off-by: Mike Christie <michaelc@xxxxxxxxxxx>

diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 2528a0c..5ca72c5 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -223,7 +223,7 @@ static int verify_command(struct file *f
 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];
@@ -271,7 +271,8 @@ static int sg_io(struct file *file, requ
 
 	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)


-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux