Skip to content

Commit

Permalink
net: caif: spi: fix potential NULL dereference
Browse files Browse the repository at this point in the history
alloc_netdev() is not checked here for NULL return value.  dev is
check instead.  It might lead to NULL dereference of ndev.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vasiliy Kulikov authored and David S. Miller committed Nov 18, 2010
1 parent 7d8e76b commit 8ea9122
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/caif/caif_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,8 @@ int cfspi_spi_probe(struct platform_device *pdev)

ndev = alloc_netdev(sizeof(struct cfspi),
"cfspi%d", cfspi_setup);
if (!dev)
return -ENODEV;
if (!ndev)
return -ENOMEM;

cfspi = netdev_priv(ndev);
netif_stop_queue(ndev);
Expand Down

0 comments on commit 8ea9122

Please sign in to comment.