From: Oskar Andero <oskar.andero@sonymobile.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Cc: "JBottomley@parallels.com" <JBottomley@parallels.com>,
"Lekanovic, Radovan" <Radovan.Lekanovic@sonymobile.com>,
"Itou, Syunsuke X" <Syunsuke.X.Itou@sonymobile.com>
Subject: Re: [PATCH] scsi: fix null pointer dereference in sd_revalidate_disk
Date: Mon, 8 Apr 2013 13:42:58 +0200 [thread overview]
Message-ID: <20130408114251.GK2481@caracas.corpusers.net> (raw)
In-Reply-To: <1362663400-9517-1-git-send-email-oskar.andero@sonymobile.com>
On 14:36 Thu 07 Mar , oskar.andero@sonymobile.com wrote:
> From: "syunsuke.x.itou" <syunsuke.x.itou@sonymobile.com>
>
> By repeatadly connecting/disconnecting a USB masstorage device
> a null pointer dereference can be provoked. This is caused by
> sd_revalidate_disk() assuming sdkp to be a valid pointer. This
> patch adds a null pointer check.
>
> Reviewed-by: Radovan Lekanovic <radovan.lekanovic@sonymobile.com>
> Signed-off-by: syunsuke.x.itou <syunsuke.x.itou@sonymobile.com>
> Signed-off-by: Oskar Andero <oskar.andero@sonymobile.com>
> ---
> drivers/scsi/sd.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 7992635..49849ce 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -1,6 +1,7 @@
> /*
> * sd.c Copyright (C) 1992 Drew Eckhardt
> * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale
> + * Copyright (C) 2013 Sony Mobile Communications AB.
> *
> * Linux scsi disk driver
> * Initial versions: Drew Eckhardt
> @@ -2653,10 +2654,14 @@ static int sd_try_extended_inquiry(struct scsi_device *sdp)
> static int sd_revalidate_disk(struct gendisk *disk)
> {
> struct scsi_disk *sdkp = scsi_disk(disk);
> - struct scsi_device *sdp = sdkp->device;
> + struct scsi_device *sdp;
> unsigned char *buffer;
> unsigned flush = 0;
>
> + if (!sdkp)
> + return -ENODEV;
> + sdp = sdkp->device;
> +
> SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp,
> "sd_revalidate_disk\n"));
>
> --
> 1.7.8.6
>
Ping. Any input on the patch above?
Thanks,
-Oskar
next parent reply other threads:[~2013-04-08 11:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1362663400-9517-1-git-send-email-oskar.andero@sonymobile.com>
2013-04-08 11:42 ` Oskar Andero [this message]
2013-04-08 16:39 ` [PATCH] scsi: fix null pointer dereference in sd_revalidate_disk James Bottomley
2013-04-09 12:32 ` Oskar Andero
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=20130408114251.GK2481@caracas.corpusers.net \
--to=oskar.andero@sonymobile.com \
--cc=JBottomley@parallels.com \
--cc=Radovan.Lekanovic@sonymobile.com \
--cc=Syunsuke.X.Itou@sonymobile.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