2020-09-02 11:20:11

by Denis Efremov (Oracle)

[permalink] [raw]
Subject: [PATCH] net: bcmgenet: fix mask check in bcmgenet_validate_flow()

VALIDATE_MASK(eth_mask->h_source) is checked twice in a row in
bcmgenet_validate_flow(). Add VALIDATE_MASK(eth_mask->h_dest)
instead.

Fixes: 3e370952287c ("net: bcmgenet: add support for ethtool rxnfc flows")
Cc: [email protected]
Signed-off-by: Denis Efremov <[email protected]>
---
I'm not sure that h_dest check is required here, it's only my guess.
Compile tested only.

drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 0ca8436d2e9d..be85dad2e3bc 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1364,7 +1364,7 @@ static int bcmgenet_validate_flow(struct net_device *dev,
case ETHER_FLOW:
eth_mask = &cmd->fs.m_u.ether_spec;
/* don't allow mask which isn't valid */
- if (VALIDATE_MASK(eth_mask->h_source) ||
+ if (VALIDATE_MASK(eth_mask->h_dest) ||
VALIDATE_MASK(eth_mask->h_source) ||
VALIDATE_MASK(eth_mask->h_proto)) {
netdev_err(dev, "rxnfc: Unsupported mask\n");
--
2.26.2


2020-09-02 17:54:38

by Doug Berger

[permalink] [raw]
Subject: Re: [PATCH] net: bcmgenet: fix mask check in bcmgenet_validate_flow()

On 9/2/2020 4:18 AM, Denis Efremov wrote:
> VALIDATE_MASK(eth_mask->h_source) is checked twice in a row in
> bcmgenet_validate_flow(). Add VALIDATE_MASK(eth_mask->h_dest)
> instead.
>
> Fixes: 3e370952287c ("net: bcmgenet: add support for ethtool rxnfc flows")
> Cc: [email protected]
> Signed-off-by: Denis Efremov <[email protected]>
> ---
> I'm not sure that h_dest check is required here, it's only my guess.
> Compile tested only.
>
> drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 0ca8436d2e9d..be85dad2e3bc 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -1364,7 +1364,7 @@ static int bcmgenet_validate_flow(struct net_device *dev,
> case ETHER_FLOW:
> eth_mask = &cmd->fs.m_u.ether_spec;
> /* don't allow mask which isn't valid */
> - if (VALIDATE_MASK(eth_mask->h_source) ||
> + if (VALIDATE_MASK(eth_mask->h_dest) ||
> VALIDATE_MASK(eth_mask->h_source) ||
> VALIDATE_MASK(eth_mask->h_proto)) {
> netdev_err(dev, "rxnfc: Unsupported mask\n");
>
Well spotted. Thanks!

Acked-by: Doug Berger <[email protected]>

2020-09-02 17:56:08

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH] net: bcmgenet: fix mask check in bcmgenet_validate_flow()



On 9/2/2020 4:18 AM, Denis Efremov wrote:
> VALIDATE_MASK(eth_mask->h_source) is checked twice in a row in
> bcmgenet_validate_flow(). Add VALIDATE_MASK(eth_mask->h_dest)
> instead.
>
> Fixes: 3e370952287c ("net: bcmgenet: add support for ethtool rxnfc flows")
> Cc: [email protected]
> Signed-off-by: Denis Efremov <[email protected]>

Acked-by: Florian Fainelli <[email protected]>
--
Florian

2020-09-02 19:56:26

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] net: bcmgenet: fix mask check in bcmgenet_validate_flow()

From: Denis Efremov <[email protected]>
Date: Wed, 2 Sep 2020 14:18:45 +0300

> VALIDATE_MASK(eth_mask->h_source) is checked twice in a row in
> bcmgenet_validate_flow(). Add VALIDATE_MASK(eth_mask->h_dest)
> instead.
>
> Fixes: 3e370952287c ("net: bcmgenet: add support for ethtool rxnfc flows")
> Cc: [email protected]
> Signed-off-by: Denis Efremov <[email protected]>

Please do not CC: stable for networking patches.

Applied and queued up for -stable, thank you.