[PATCH v2] af/rvu_cgx: Fix missing check bugs in rvu_cgx.c

Subsystems: marvell octeontx2 rvu admin function driver, networking drivers, the rest

STALE2042d

2 messages, 2 authors, 2021-01-06 · open the first message on its own page

[PATCH v2] af/rvu_cgx: Fix missing check bugs in rvu_cgx.c

From: <hidden>
Date: 2021-01-06 10:53:12

From: Yingjie Wang <redacted>

In rvu_mbox_handler_cgx_mac_addr_get()
and rvu_mbox_handler_cgx_mac_addr_set(),
the msg is expected only from PFs that are mapped to CGX LMACs.
It should be checked before mapping,
so we add the is_cgx_config_permitted() in the functions.

Fixes: 85482bb ("af/rvu_cgx: Fix missing check bugs in rvu_cgx.c")
Signed-off-by: Yingjie Wang <redacted>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
index d298b93..6c6b411 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
@@ -469,6 +469,9 @@ int rvu_mbox_handler_cgx_mac_addr_set(struct rvu *rvu,
 	int pf = rvu_get_pf(req->hdr.pcifunc);
 	u8 cgx_id, lmac_id;
 
+	if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
+		return -EPERM;
+
 	rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
 
 	cgx_lmac_addr_set(cgx_id, lmac_id, req->mac_addr);
@@ -485,6 +488,9 @@ int rvu_mbox_handler_cgx_mac_addr_get(struct rvu *rvu,
 	int rc = 0, i;
 	u64 cfg;
 
+	if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
+		return -EPERM;
+
 	rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
 
 	rsp->hdr.rc = rc;
-- 
2.7.4

Re: [PATCH v2] af/rvu_cgx: Fix missing check bugs in rvu_cgx.c

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-01-06 23:19:43

On Tue,  5 Jan 2021 22:49:17 -0800 wangyingjie55@126.com wrote:
From: Yingjie Wang <redacted>

In rvu_mbox_handler_cgx_mac_addr_get()
and rvu_mbox_handler_cgx_mac_addr_set(),
the msg is expected only from PFs that are mapped to CGX LMACs.
It should be checked before mapping,
so we add the is_cgx_config_permitted() in the functions.

Fixes: 85482bb ("af/rvu_cgx: Fix missing check bugs in rvu_cgx.c")
Signed-off-by: Yingjie Wang <redacted>
Thanks for the tag but:

Fixes tag: Fixes: 85482bb ("af/rvu_cgx: Fix missing check bugs in rvu_cgx.c")
Has these problem(s):
	- Target SHA1 does not exist

This hash does not seem to exist in any tree known to linux-next.

The hash should also be at least 12 chars.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help