All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Jens Axboe <axboe@suse.de>
Cc: Patrick Mansfield <patmans@us.ibm.com>,
	Andrew de Quincey <adq_dvb@lidskialf.net>,
	linux1394-devel@lists.sourceforge.net,
	linux-scsi@vger.kernel.org,
	James Bottomley <James.Bottomley@steeleye.com>
Subject: Re: linux kernel panic when ejecting ieee1394 ipod
Date: Fri, 09 Dec 2005 19:39:55 +0100	[thread overview]
Message-ID: <4399CF7B.7060708@s5r6.in-berlin.de> (raw)
In-Reply-To: <20051209134216.GO26185@suse.de>

Jens Axboe wrote:
> This looks like the real bug.
> 
> ---
> 
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 4afef5c..0978887 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1215,12 +1215,12 @@ static int scsi_prep_fn(struct request_q
>  		} else {
>  			memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
>  			cmd->cmd_len = req->cmd_len;
> -			if (rq_data_dir(req) == WRITE)
> +			if (!req->data_len)
> +				cmd->sc_data_direction = DMA_NONE;
> +			else if (rq_data_dir(req) == WRITE)
>  				cmd->sc_data_direction = DMA_TO_DEVICE;
> -			else if (req->data_len)
> -				cmd->sc_data_direction = DMA_FROM_DEVICE;
>  			else
> -				cmd->sc_data_direction = DMA_NONE;
> +				cmd->sc_data_direction = DMA_FROM_DEVICE;
>  			
>  			cmd->transfersize = req->data_len;
>  			cmd->allowed = 3;
> 
> 

And then there are also sd_init_command(), sr_init_command(), 
st_init_command() in s[drt].c. sr_init_command() looks OK to me, the 
other two feature the same flaw like scsi_prep_fn().

Or is there any reason why they should set DMA_TO_DEVICE while 
rq->data_len == 0?

Furthermore, is there any other code path which may set 
cmd->sc_data_direction, aside from s[drt]_init_command() and 
scsi_prep_fn()? I was just browsing the code to find out myself but am 
not 100% sure.
-- 
Stefan Richter
-=====-=-=-= ==-- -=--=
http://arcgraph.de/sr/

  reply	other threads:[~2005-12-09 18:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200512072358.15398.adq_dvb@lidskialf.net>
2005-12-08  1:17 ` linux kernel panic when ejecting ieee1394 ipod Stefan Richter
2005-12-08  1:57 ` Andrew de Quincey
     [not found] ` <200512080119.48740.adq@lidskialf.net>
2005-12-08  1:59   ` Andrew de Quincey
2005-12-08  2:09     ` Andrew de Quincey
2005-12-08  2:44       ` Stefan Richter
2005-12-08  3:19         ` Andrew de Quincey
2005-12-08  7:52           ` Stefan Richter
2005-12-08 19:27             ` Stefan Richter
2005-12-08 17:34         ` Patrick Mansfield
2005-12-08 19:25           ` Stefan Richter
2005-12-09 13:37           ` Jens Axboe
2005-12-09 13:42             ` Jens Axboe
2005-12-09 18:39               ` Stefan Richter [this message]
2005-12-09 19:35                 ` Stefan Richter
2005-12-09 22:45                   ` James Bottomley
2005-12-10 18:20                     ` Christoph Hellwig
2005-12-13 20:44                     ` Stefan Richter
2005-12-13 20:54                       ` Jens Axboe
2005-12-10  8:48                   ` Jens Axboe
2005-12-10  9:28                     ` Christoph Hellwig
2005-12-10 10:55                       ` Stefan Richter

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=4399CF7B.7060708@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=James.Bottomley@steeleye.com \
    --cc=adq_dvb@lidskialf.net \
    --cc=axboe@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=patmans@us.ibm.com \
    /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.