lkml.org 
[lkml]   [2020]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 455/639] bnxt_en: Fix ethtool selftest crash under error conditions.
    Date
    From: Michael Chan <michael.chan@broadcom.com>

    [ Upstream commit d27e2ca1166aefd54d9c48fb6647dee8115a5dfc ]

    After ethtool loopback packet tests, we re-open the nic for the next
    IRQ test. If the open fails, we must not proceed with the IRQ test
    or we will crash with NULL pointer dereference. Fix it by checking
    the bnxt_open_nic() return code before proceeding.

    Reported-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
    Fixes: 67fea463fd87 ("bnxt_en: Add interrupt test to ethtool -t selftest.")
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
    index 0a409ba4012a3..dc63d269f01dc 100644
    --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
    +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
    @@ -2600,7 +2600,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
    bool offline = false;
    u8 test_results = 0;
    u8 test_mask = 0;
    - int rc, i;
    + int rc = 0, i;

    if (!bp->num_tests || !BNXT_SINGLE_PF(bp))
    return;
    @@ -2671,9 +2671,9 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
    }
    bnxt_hwrm_phy_loopback(bp, false, false);
    bnxt_half_close_nic(bp);
    - bnxt_open_nic(bp, false, true);
    + rc = bnxt_open_nic(bp, false, true);
    }
    - if (bnxt_test_irq(bp)) {
    + if (rc || bnxt_test_irq(bp)) {
    buf[BNXT_IRQ_TEST_IDX] = 1;
    etest->flags |= ETH_TEST_FL_FAILED;
    }
    --
    2.20.1


    \
     
     \ /
      Last update: 2020-01-24 12:26    [W:3.578 / U:0.320 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site