octeontx2-af: Fix possible null pointer dereference.
authorRakesh Babu Saladi <rsaladi2@marvell.com>
Wed, 27 Oct 2021 17:32:34 +0000 (23:02 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Oct 2021 13:47:37 +0000 (14:47 +0100)
This patch fixes possible null pointer dereference in files
"rvu_debugfs.c" and "rvu_nix.c"

Fixes: 8756828a8148 ("octeontx2-af: Add NPA aura and pool contexts to debugfs")
Fixes: 9a946def264d ("octeontx2-af: Modify nix_vtag_cfg mailbox to support TX VTAG entries")
Signed-off-by: Rakesh Babu Saladi <rsaladi2@marvell.com>
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c

index c7e1246..49d822a 100644 (file)
@@ -578,7 +578,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
        if (cmd_buf)
                ret = -EINVAL;
 
-       if (!strncmp(subtoken, "help", 4) || ret < 0) {
+       if (ret < 0 || !strncmp(subtoken, "help", 4)) {
                dev_info(rvu->dev, "Use echo <%s-lf > qsize\n", blk_string);
                goto qsize_write_done;
        }
index 9ef4e94..6970540 100644 (file)
@@ -2507,6 +2507,9 @@ static void nix_free_tx_vtag_entries(struct rvu *rvu, u16 pcifunc)
                return;
 
        nix_hw = get_nix_hw(rvu->hw, blkaddr);
+       if (!nix_hw)
+               return;
+
        vlan = &nix_hw->txvlan;
 
        mutex_lock(&vlan->rsrc_lock);