From: Douglas Gilbert <dougg@torque.net>
To: linux-scsi@vger.kernel.org
Cc: bunk@fs.tum.de, Michel.R.Garnier@wanadoo.fr
Subject: [PATCH] sg jiffy library calls [was: sg kill local jiffies problems]
Date: Mon, 06 Sep 2004 18:51:38 +1000 [thread overview]
Message-ID: <413C251A.1050105@torque.net> (raw)
In-Reply-To: <413A778C.1000302@torque.net>
[-- Attachment #1: Type: text/plain, Size: 780 bytes --]
Douglas Gilbert wrote:
> It has been reported that the change to sg.c in lk 2.6.9-rc1-bk5
> to use library jiffy functions breaks sg (albeit under vmware).
> Evidentally sg devices are no longer recognised after that change.
>
> Reverting that changeset removes the problem. Strange, it is not
> obvious why.
>
> At some stage I must have detected negative time spans (yeh yeh it
> never happens) and my versions returned 0 in this case; otherwise
> the implementations look very similar.
The following patch fixes the problem. It is
against lk 2.6.9-rc1-bk7 (i.e. after "standard"
jiffy_to_millisecs macros replaced sg versions).
Change:
- make sure a (large) user supplied timeout value does
not result in a negative timeout passed to the midlevel
Doug Gilbert
[-- Attachment #2: sg_269rc1bk7jif.diff --]
[-- Type: text/x-patch, Size: 703 bytes --]
--- linux/drivers/scsi/sg.c 2004-09-01 11:48:55.000000000 +1000
+++ linux/drivers/scsi/sg.c269rc1bk7jif 2004-09-06 17:00:56.000000000 +1000
@@ -576,6 +576,7 @@
sg_io_hdr_t *hp;
unsigned char cmnd[sizeof (dummy_cmdp->sr_cmnd)];
int timeout;
+ unsigned long ul_timeout;
if (count < SZ_SG_IO_HDR)
return -EINVAL;
@@ -610,7 +611,8 @@
return -EBUSY; /* reserve buffer already being used */
}
}
- timeout = msecs_to_jiffies(srp->header.timeout);
+ ul_timeout = msecs_to_jiffies(srp->header.timeout);
+ timeout = (ul_timeout < INT_MAX) ? ul_timeout : INT_MAX;
if ((!hp->cmdp) || (hp->cmd_len < 6) || (hp->cmd_len > sizeof (cmnd))) {
sg_remove_request(sfp, srp);
return -EMSGSIZE;
prev parent reply other threads:[~2004-09-06 8:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-05 2:18 sg kill local jiffies problems Douglas Gilbert
2004-09-06 8:51 ` Douglas Gilbert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=413C251A.1050105@torque.net \
--to=dougg@torque.net \
--cc=Michel.R.Garnier@wanadoo.fr \
--cc=bunk@fs.tum.de \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.