From: Mike Christie <michaelc@cs.wisc.edu>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [BUG] Yet another scsi_cmnd leak?
Date: Thu, 29 Sep 2005 15:31:43 -0500 [thread overview]
Message-ID: <433C4F2F.2050805@cs.wisc.edu> (raw)
In-Reply-To: <433C4E7A.7010205@cs.wisc.edu>
Mike Christie wrote:
> Alan Stern wrote:
>
>> James:
>>
>> This report is based on 2.6.14-rc2-git6. The code in your
>> scsi-misc-2.6 git tree is somewhat different (and I don't know which
>> is more current), but it still contains the same bug.
>>
>>
>> In scsi_prep_fn, a request can get deferred if scsi_init_io fails to
>> allocate an sg table. When this happens, the scsi_cmnd isn't released
>> and the request is not marked DONTPREP.
>>
>> Then when scsi_prep_fn is called again, the request may be killed for
>> a number of reasons. The code branches to the kill: label near the
>> end of the routine, which returns BLKPREP_KILL.
>>
>> Isn't it true that when this happens, the scsi_cmnd allocated during the
>> original prep will never be released?
>>
>> It appears that scsi_prep_fn is undecided about whether or not the
>> request
>> is allowed to have a scsi_cmnd already. The jumps to kill: seem to
>> assume
>> that it isn't, but the code for allocating a new scsi_cmnd tests for an
>> existing one first.
>>
>
> The gotos used to be just a return BLKPREP* and were added so I did not
> have to write DID_NO_CONNECT or unplug multiple times :) I think you are
> right and we need to further unwind what a previous prep had done
> becuase when we return with BLKPREP_KILL we only hear about this command
I did not mean command as in struct scsi_cmnd command. I think only the
scsi_request or REQ_BLOCK_PC code sets the end_io or waiting fields so I
really meant request or scsi_request.
> again if it's request has a end_io function or waiting completion.
>
next prev parent reply other threads:[~2005-09-29 20:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-29 20:02 [BUG] Yet another scsi_cmnd leak? Alan Stern
2005-09-29 20:28 ` Mike Christie
2005-09-29 20:31 ` Mike Christie [this message]
2005-10-03 15:34 ` Alan Stern
2005-10-04 15:51 ` Mike Christie
2005-10-14 15:23 ` [PATCH] Fix leak of Scsi_Cmnds Alan Stern
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=433C4F2F.2050805@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=James.Bottomley@SteelEye.com \
--cc=linux-scsi@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).