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] [day] [month] [year] [list]
Date:   Tue, 31 May 2022 09:40:20 +0800
From:   baihaowen <baihaowen@...zu.com>
To:     Don Brace <don.brace@...rochip.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
CC:     <storagedev@...rochip.com>, <linux-scsi@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] scsi: hpsa: Fix pointer dereferenced before checking

在 2022/5/30 下午4:26, Haowen Bai 写道:
> The dev->raid_map is dereferencing before null checking, so move
>  it after checking.
>
> Signed-off-by: Haowen Bai <baihaowen@...zu.com>
> ---
>  drivers/scsi/hpsa.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index a47bcce3c9c7..fa785f60b1e6 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -5104,7 +5104,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
>  {
>  	struct scsi_cmnd *cmd = c->scsi_cmd;
>  	struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
> -	struct raid_map_data *map = &dev->raid_map;
> +	struct raid_map_data *map;
>  	struct raid_map_disk_data *dd = &map->data[0];
>  	int is_write = 0;
>  	u32 map_index;
> @@ -5137,6 +5137,8 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
>  	if (!dev)
>  		return -1;
>  
> +	map = &dev->raid_map;
> +
>  	if (dev->in_reset)
>  		return -1;
>  

Sorry, plz ignore this patch.

dev->raid_map is dereferenced, &dev->raid_map is just a pointer math for pointer address offset, so it would not cause a bug(dereferencing null pointer).

-- 
Haowen Bai

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ