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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 29 Jul 2019 19:51:29 +0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     stern@...land.harvard.edu, gregkh@...uxfoundation.org,
        Oliver Neukum <oneukum@...e.com>
Cc:     linux-usb@...r.kernel.org, usb-storage@...ts.one-eyed-alien.net,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] usb: storage: sddr55: Fix a possible null-pointer
 dereference in sddr55_transport()

Sorry, I forgot to send to Oliver, so send it again.

On 2019/7/29 19:49, Jia-Ju Bai wrote:
> In sddr55_transport(), there is an if statement on line 836 to check
> whether info->lba_to_pba is NULL:
>      if (info->lba_to_pba == NULL || ...)
>
> When info->lba_to_pba is NULL, it is used on line 948:
>      pba = info->lba_to_pba[lba];
>
> Thus, a possible null-pointer dereference may occur.
>
> To fix this bug, info->lba_to_pba is checked before being used.
>
> This bug is found by a static analysis tool STCheck written by us.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
> ---
> v2:
> * Avoid uninitialized access of pba.
>    Thank Oliver for helpful advice.
>
> ---
>   drivers/usb/storage/sddr55.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
> index b8527c55335b..d23aff16091e 100644
> --- a/drivers/usb/storage/sddr55.c
> +++ b/drivers/usb/storage/sddr55.c
> @@ -945,7 +945,7 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
>   			return USB_STOR_TRANSPORT_FAILED;
>   		}
>   
> -		pba = info->lba_to_pba[lba];
> +		pba = info->lba_to_pba ? info->lba_to_pba[lba] : 0;
>   
>   		if (srb->cmnd[0] == WRITE_10) {
>   			usb_stor_dbg(us, "WRITE_10: write block %04X (LBA %04X) page %01X pages %d\n",

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ