netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] bnxt_en: 2 small bug fixes.
@ 2018-01-04 23:46 Michael Chan
  2018-01-04 23:46 ` [PATCH net 1/2] bnxt_en: Fix population of flow_type in bnxt_hwrm_cfa_flow_alloc() Michael Chan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Chan @ 2018-01-04 23:46 UTC (permalink / raw)
  To: davem; +Cc: netdev

The first one fixes the TC Flower flow parameter passed to firmware.  The
2nd one fixes the VF index range checking for iproute2 SRIOV related commands.

Sunil Challa (1):
  bnxt_en: Fix population of flow_type in bnxt_hwrm_cfa_flow_alloc()

Venkat Duvvuru (1):
  bnxt_en: Fix the 'Invalid VF' id check in bnxt_vf_ndo_prep routine.

 drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 2 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
1.8.3.1

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

* [PATCH net 1/2] bnxt_en: Fix population of flow_type in bnxt_hwrm_cfa_flow_alloc()
  2018-01-04 23:46 [PATCH net 0/2] bnxt_en: 2 small bug fixes Michael Chan
@ 2018-01-04 23:46 ` Michael Chan
  2018-01-04 23:46 ` [PATCH net 2/2] bnxt_en: Fix the 'Invalid VF' id check in bnxt_vf_ndo_prep routine Michael Chan
  2018-01-08 19:13 ` [PATCH net 0/2] bnxt_en: 2 small bug fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Chan @ 2018-01-04 23:46 UTC (permalink / raw)
  To: davem; +Cc: netdev

From: Sunil Challa <sunilkumar.challa@broadcom.com>

flow_type in HWRM_FLOW_ALLOC is not being populated correctly due to
incorrect passing of pointer and size of l3_mask argument of is_wildcard().
Fixed this.

Fixes: db1d36a27324 ("bnxt_en: add TC flower offload flow_alloc/free FW cmds")
Signed-off-by: Sunil Challa <sunilkumar.challa@broadcom.com>
Reviewed-by: Sathya Perla <sathya.perla@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
index 3d201d7..d8fee26 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
@@ -421,7 +421,7 @@ static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow,
 	}
 
 	/* If all IP and L4 fields are wildcarded then this is an L2 flow */
-	if (is_wildcard(&l3_mask, sizeof(l3_mask)) &&
+	if (is_wildcard(l3_mask, sizeof(*l3_mask)) &&
 	    is_wildcard(&flow->l4_mask, sizeof(flow->l4_mask))) {
 		flow_flags |= CFA_FLOW_ALLOC_REQ_FLAGS_FLOWTYPE_L2;
 	} else {
-- 
1.8.3.1

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

* [PATCH net 2/2] bnxt_en: Fix the 'Invalid VF' id check in bnxt_vf_ndo_prep routine.
  2018-01-04 23:46 [PATCH net 0/2] bnxt_en: 2 small bug fixes Michael Chan
  2018-01-04 23:46 ` [PATCH net 1/2] bnxt_en: Fix population of flow_type in bnxt_hwrm_cfa_flow_alloc() Michael Chan
@ 2018-01-04 23:46 ` Michael Chan
  2018-01-08 19:13 ` [PATCH net 0/2] bnxt_en: 2 small bug fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Chan @ 2018-01-04 23:46 UTC (permalink / raw)
  To: davem; +Cc: netdev

From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>

In bnxt_vf_ndo_prep (which is called by bnxt_get_vf_config ndo), there is a
check for "Invalid VF id". Currently, the check is done against max_vfs.
However, the user doesn't always create max_vfs. So, the check should be
against the created number of VFs. The number of bnxt_vf_info structures
that are allocated in bnxt_alloc_vf_resources routine is the "number of
requested VFs". So, if an "invalid VF id" falls between the requested
number of VFs and the max_vfs, the driver will be dereferencing an invalid
pointer.

Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: Venkat Devvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
index 5ee1866..c961767 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
@@ -70,7 +70,7 @@ static int bnxt_vf_ndo_prep(struct bnxt *bp, int vf_id)
 		netdev_err(bp->dev, "vf ndo called though sriov is disabled\n");
 		return -EINVAL;
 	}
-	if (vf_id >= bp->pf.max_vfs) {
+	if (vf_id >= bp->pf.active_vfs) {
 		netdev_err(bp->dev, "Invalid VF id %d\n", vf_id);
 		return -EINVAL;
 	}
-- 
1.8.3.1

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

* Re: [PATCH net 0/2] bnxt_en: 2 small bug fixes.
  2018-01-04 23:46 [PATCH net 0/2] bnxt_en: 2 small bug fixes Michael Chan
  2018-01-04 23:46 ` [PATCH net 1/2] bnxt_en: Fix population of flow_type in bnxt_hwrm_cfa_flow_alloc() Michael Chan
  2018-01-04 23:46 ` [PATCH net 2/2] bnxt_en: Fix the 'Invalid VF' id check in bnxt_vf_ndo_prep routine Michael Chan
@ 2018-01-08 19:13 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-01-08 19:13 UTC (permalink / raw)
  To: michael.chan; +Cc: netdev

From: Michael Chan <michael.chan@broadcom.com>
Date: Thu,  4 Jan 2018 18:46:53 -0500

> The first one fixes the TC Flower flow parameter passed to firmware.  The
> 2nd one fixes the VF index range checking for iproute2 SRIOV related commands.

Series applied, thank you.

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

end of thread, other threads:[~2018-01-08 19:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04 23:46 [PATCH net 0/2] bnxt_en: 2 small bug fixes Michael Chan
2018-01-04 23:46 ` [PATCH net 1/2] bnxt_en: Fix population of flow_type in bnxt_hwrm_cfa_flow_alloc() Michael Chan
2018-01-04 23:46 ` [PATCH net 2/2] bnxt_en: Fix the 'Invalid VF' id check in bnxt_vf_ndo_prep routine Michael Chan
2018-01-08 19:13 ` [PATCH net 0/2] bnxt_en: 2 small bug fixes David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).