diff mbox series

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

Message ID 1610417389-9051-1-git-send-email-wangyingjie55@126.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v2] af/rvu_cgx: 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 warning 5 maintainers not CCed: sgoutham@marvell.com jerinj@marvell.com gakula@marvell.com davem@davemloft.net lcherian@marvell.com
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 fail Link
netdev/checkpatch warning WARNING: Unknown commit id '289e20bc1ab5', maybe rebased or not pulled?
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. 12, 2021, 2:09 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: 289e20bc1ab5 ("af/rvu_cgx: Fix missing check bugs in rvu_cgx.c")
Signed-off-by: Yingjie Wang <wangyingjie55@126.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jakub Kicinski Jan. 13, 2021, 2:13 a.m. UTC | #1
On Mon, 11 Jan 2021 18:09:49 -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.
> 
> Fixes: 289e20bc1ab5 ("af/rvu_cgx: Fix missing check bugs in rvu_cgx.c")
> Signed-off-by: Yingjie Wang <wangyingjie55@126.com>


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

Where is that commit from? You're not referring to this commit itself
in your tree? The subject is suspiciously similar :S
Yingjie Wang Jan. 13, 2021, 1:27 p.m. UTC | #2
Thanks for your reply.  I commit this change on linux-next/stable branch, and I use "git log --pretty=fixes" command to get the Fixes tag. I want to know if I need to make a change on any other branch and commit it?
At 2021-01-13 10:13:28, "Jakub Kicinski" <kuba@kernel.org> wrote:
>On Mon, 11 Jan 2021 18:09:49 -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.
>> 
>> Fixes: 289e20bc1ab5 ("af/rvu_cgx: Fix missing check bugs in rvu_cgx.c")
>> Signed-off-by: Yingjie Wang <wangyingjie55@126.com>
>
>
>Fixes tag: Fixes: 289e20bc1ab5 ("af/rvu_cgx: Fix missing check bugs in rvu_cgx.c")
>Has these problem(s):
>	- Target SHA1 does not exist
>
>Where is that commit from? You're not referring to this commit itself
>in your tree? The subject is suspiciously similar :S
Jakub Kicinski Jan. 13, 2021, 11:35 p.m. UTC | #3
On Wed, 13 Jan 2021 21:27:35 +0800 (CST) Yingjie Wang wrote:
> Thanks for your reply.  I commit this change on linux-next/stable
> branch, and I use "git log --pretty=fixes" command to get the Fixes
> tag. I want to know if I need to make a change on any other branch
> and commit it?

For networking fixes net/master would be best, but my comment
wasn't about the tree, but about which commit is quoted in the Fixes
tag.

Maybe the maintainers will help us identify the right fixes tag.
CCing them now. Please make sure to always CC maintainers
(scripts/get_maintainer.pl should help you).

Marvell folks, FWIW this is the thread in the archive for context:
https://lore.kernel.org/lkml/1610417389-9051-1-git-send-email-wangyingjie55@126.com/
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;