All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] af/rvu_cgx: Fix missing check bugs in rvu_cgx.c
@ 2020-12-30  7:24 wangyingjie55
  2021-01-04 21:26 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: wangyingjie55 @ 2020-12-30  7:24 UTC (permalink / raw)
  To: kuba, sgoutham, lcherian, gakula, jerinj, davem
  Cc: netdev, linux-kernel, Yingjie Wang

From: Yingjie Wang <wangyingjie55@126.com>

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.

Signed-off-by: Yingjie Wang <wangyingjie55@126.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] af/rvu_cgx: Fix missing check bugs in rvu_cgx.c
  2020-12-30  7:24 [PATCH v1] af/rvu_cgx: Fix missing check bugs in rvu_cgx.c wangyingjie55
@ 2021-01-04 21:26 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-01-04 21:26 UTC (permalink / raw)
  To: wangyingjie55
  Cc: sgoutham, lcherian, gakula, jerinj, davem, netdev, linux-kernel

On Tue, 29 Dec 2020 23:24:26 -0800 wangyingjie55@126.com wrote:
> From: Yingjie Wang <wangyingjie55@126.com>
> 
> 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.
> 
> Signed-off-by: Yingjie Wang <wangyingjie55@126.com>

Please include an appropriate Fixes tag and repost, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-04 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30  7:24 [PATCH v1] af/rvu_cgx: Fix missing check bugs in rvu_cgx.c wangyingjie55
2021-01-04 21:26 ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.