]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns3: Fix potential null pointer defererence of null ae_dev
authorColin Ian King <colin.king@canonical.com>
Fri, 9 Apr 2021 16:37:26 +0000 (17:37 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Apr 2021 20:15:21 +0000 (13:15 -0700)
commit97355f2fe3111c5a68c19b1b7d2106757e1c2da7
tree065099f245c66dc8f0ae121796eff761c81ee7f1
parentc764e71cd465a03007bde117229d8d22e945c9e0
net: hns3: Fix potential null pointer defererence of null ae_dev

The reset_prepare and reset_done calls have a null pointer check
on ae_dev however ae_dev is being dereferenced via the call to
ns3_is_phys_func with the ae->pdev argument. Fix this by performing
a null pointer check on ae_dev and hence short-circuiting the
dereference to ae_dev on the call to ns3_is_phys_func.

Addresses-Coverity: ("Dereference before null check")
Fixes: 8a256e14ef52 ("net: hns3: add suspend and resume pm_ops")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c