]> git.baikalelectronics.ru Git - kernel.git/commit
ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Sat, 21 May 2022 20:34:10 +0000 (23:34 +0300)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Mon, 6 Jun 2022 00:52:17 +0000 (09:52 +0900)
commitb051732827bc6026042faf0c3715b798d9a40a97
tree17e2ef38ae7a12ccdcf14672e53b744507e25ac0
parent6855530d6a489f0d141d097cf28e0b15c1378b61
ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo()

In an unlikely (and probably wrong?) case that the 'ppi' parameter of
ata_host_alloc_pinfo() points to an array starting with a NULL pointer,
there's going to be a kernel oops as the 'pi' local variable won't get
reassigned from the initial value of NULL. Initialize 'pi' instead to
'&ata_dummy_port_info' to fix the possible kernel oops for good...

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
drivers/ata/libata-core.c