Re: [PATCH v2 1/9] libata: fix ata_host_alloc_pinfo()
From: Hannes Reinecke <hare@suse.de>
Date: 2021-08-06 08:49:55
Also in:
linux-block, linux-scsi
From: Hannes Reinecke <hare@suse.de>
Date: 2021-08-06 08:49:55
Also in:
linux-block, linux-scsi
On 8/6/21 9:42 AM, Damien Le Moal wrote:
Avoid a potential NULL pointer dereference by testing that the ATA port info variable "pi". Reported-by: kernel test robot <redacted> Signed-off-by: Damien Le Moal <redacted> --- drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 61c762961ca8..ea8b91297f12 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c@@ -5458,7 +5458,7 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev, ap->link.flags |= pi->link_flags; ap->ops = pi->port_ops; - if (!host->ops && (pi->port_ops != &ata_dummy_port_ops)) + if (!host->ops && pi && pi->port_ops != &ata_dummy_port_ops) host->ops = pi->port_ops; }
Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer