diff mbox series

[v3] octeontx2-af: Fix missing check bugs in rvu_cgx.c

Message ID 1610602240-23404-1-git-send-email-wangyingjie55@126.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v3] octeontx2-af: Fix missing check bugs in rvu_cgx.c | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Yingjie Wang Jan. 14, 2021, 5:30 a.m. UTC
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.

Fixes: 96be2e0da85e ("octeontx2-af: Support for MAC address filters in CGX")
Signed-off-by: Yingjie Wang <wangyingjie55@126.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Geetha sowjanya Jan. 15, 2021, 10:58 a.m. UTC | #1
The changes look good to me.

You can add:
Reviewed-by: Geetha sowjanya<gakula@marvell.com>
Yingjie Wang Jan. 15, 2021, 1:27 p.m. UTC | #2
Thanks for your reply. I have resended the email with the Reviewed-by tag.
At 2021-01-15 18:58:49, "Geethasowjanya Akula" <gakula@marvell.com> wrote:
>The changes look good to me.
>
>You can add:
>Reviewed-by: Geetha sowjanya<gakula@marvell.com>
>
>________________________________________
>From: wangyingjie55@126.com <wangyingjie55@126.com>
>Sent: Thursday, January 14, 2021 11:00 AM
>To: davem@davemloft.net; kuba@kernel.org; Vidhya Vidhyaraman; Stanislaw Kardach [C]
>Cc: Sunil Kovvuri Goutham; Linu Cherian; Geethasowjanya Akula; Jerin Jacob Kollanukkaran; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Yingjie Wang
>Subject: [EXT] [PATCH v3] octeontx2-af: Fix missing check bugs in rvu_cgx.c
>
>External Email
>
>----------------------------------------------------------------------
>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.
>
>Fixes: 96be2e0da85e ("octeontx2-af: Support for MAC address filters in CGX")
>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 d298b9357177..6c6b411e78fd 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
Jakub Kicinski Jan. 15, 2021, 7:40 p.m. UTC | #3
On Fri, 15 Jan 2021 21:27:58 +0800 (CST) Yingjie Wang wrote:
> Thanks for your reply. I have resended the email with the Reviewed-by tag.

Thanks, applied. In the future there is no need to resend to add the
tags. The automation will gather the tags the patch received on the
latest revision.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
index d298b9357177..6c6b411e78fd 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;