Commit 60623da4 authored by Dipendra Khadka's avatar Dipendra Khadka Committed by He Yujie
Browse files

octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_ethtool.c

stable inclusion
from stable-v5.10.231
commit 5ff9de1f2712cbca53da2e37d831eea7ffcb43b6
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBEGGI
CVE: CVE-2024-56728

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5ff9de1f2712cbca53da2e37d831eea7ffcb43b6



--------------------------------

[ Upstream commit e26f8eac6bb20b20fdb8f7dc695711ebce4c7c5c ]

Add error pointer check after calling otx2_mbox_get_rsp().

Fixes: 75f36270 ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
Fixes: d0cf9503 ("octeontx2-pf: ethtool fec mode support")
Signed-off-by: default avatarDipendra Khadka <kdipendra88@gmail.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Conflicts:
	drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
[ Context conflict: d0cf9503 ("octeontx2-pf: ethtool fec mode support") is not merged ]
Signed-off-by: default avatarHe Yujie <coka.heyujie@huawei.com>
parent 6aa478cf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -264,6 +264,11 @@ static void otx2_get_pauseparam(struct net_device *netdev,
	if (!otx2_sync_mbox_msg(&pfvf->mbox)) {
		rsp = (struct cgx_pause_frm_cfg *)
		       otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr);
		if (IS_ERR(rsp)) {
			mutex_unlock(&pfvf->mbox.lock);
			return;
		}

		pause->rx_pause = rsp->rx_pause;
		pause->tx_pause = rsp->tx_pause;
	}