From: Bart Van Assche <bvanassche@acm.org>
To: David Decotigny <decot@googlers.com>, linux-scsi@vger.kernel.org
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: avoid use of reclaimed reference
Date: Wed, 13 Nov 2013 13:06:43 +0100 [thread overview]
Message-ID: <52836B53.4080204@acm.org> (raw)
In-Reply-To: <643cda2192c25962f37c8bba65e22f70a57167d0.1384304973.git.decot@googlers.com>
On 11/13/13 02:10, David Decotigny wrote:
> This patch avoids to use an object after it was potentially reclaimed
> by scsi_device_put().
>
> Signed-off-by: David Decotigny <decot@googlers.com>
> ---
> drivers/scsi/scsi_scan.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index 307a811..16e4a44 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -1498,12 +1498,14 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
> out_err:
> kfree(lun_data);
> out:
> - scsi_device_put(sdev);
> - if (scsi_device_created(sdev))
> + if (scsi_device_created(sdev)) {
> /*
> * the sdev we used didn't appear in the report luns scan
> */
> __scsi_remove_device(sdev);
> + }
> +
> + scsi_device_put(sdev);
> return ret;
> }
It would help if you could explain why you started looking at this code.
Is the above patch something you came up with after having analyzed the
SCSI mid-layer source code or perhaps as the result of a test that
failed ? If so, which test was it that failed ?
Thanks,
Bart.
next prev parent reply other threads:[~2013-11-13 12:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1384304973.git.decot@googlers.com>
2013-11-13 1:10 ` [PATCH] scsi: avoid use of reclaimed reference David Decotigny
2013-11-13 1:57 ` James Bottomley
2013-11-13 2:09 ` David Decotigny
2013-11-13 6:46 ` James Bottomley
2013-11-13 12:06 ` Bart Van Assche [this message]
2013-11-14 2:50 ` David Decotigny
2013-11-14 6:15 ` James Bottomley
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=52836B53.4080204@acm.org \
--to=bvanassche@acm.org \
--cc=JBottomley@parallels.com \
--cc=decot@googlers.com \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox