]> git.baikalelectronics.ru Git - kernel.git/commit
mdio_bus: NULL dereference on allocation error
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 12 Jan 2016 09:34:36 +0000 (12:34 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Jan 2016 16:49:20 +0000 (11:49 -0500)
commitcc0b05a588ce1e484f3248117e769a0b79dc20ff
tree27d7880d4441106ab21b4c8cd782480f8f8901fb
parentb540afb19dc4297be8e93dfbb58c1302e339a784
mdio_bus: NULL dereference on allocation error

If bus = kzalloc() fails then we end up dereferencing bus when we do
"bus->irq[i] = PHY_POLL;".  The code is a little simpler if we reverse
the NULL check and return directly on failure.

Fixes: 200b167d3fff ('mdio: Move allocation of interrupts into core')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mdio_bus.c