lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 8 Apr 2013 13:42:58 +0200
From:	Oskar Andero <oskar.andero@...ymobile.com>
To:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>
CC:	"JBottomley@...allels.com" <JBottomley@...allels.com>,
	"Lekanovic, Radovan" <Radovan.Lekanovic@...ymobile.com>,
	"Itou, Syunsuke X" <Syunsuke.X.Itou@...ymobile.com>
Subject: Re: [PATCH] scsi: fix null pointer dereference in sd_revalidate_disk

On 14:36 Thu 07 Mar     , oskar.andero@...ymobile.com wrote:
> From: "syunsuke.x.itou" <syunsuke.x.itou@...ymobile.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@...ymobile.com>
> Signed-off-by: syunsuke.x.itou <syunsuke.x.itou@...ymobile.com>
> Signed-off-by: Oskar Andero <oskar.andero@...ymobile.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ