From: Yuval Mintz <yuvalmin@broadcom.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <ariele@broadcom.com>, Dmitry Kravkov <dmitry@broadcom.com>,
Yuval Mintz <yuvalmin@broadcom.com>
Subject: [PATCH net 1/5] bnx2x: limit number of interrupt vectors for 57711
Date: Sun, 5 Jan 2014 18:33:50 +0200 [thread overview]
Message-ID: <1388939634-19948-2-git-send-email-yuvalmin@broadcom.com> (raw)
In-Reply-To: <1388939634-19948-1-git-send-email-yuvalmin@broadcom.com>
From: Dmitry Kravkov <dmitry@broadcom.com>
Original straightforward division may lead to zeroing number of SB and
null-pointer dereference when device is short of MSIX vectors or lacks
MSIX capabilities.
Reported-by: Vladislav Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 2 ++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index a1f66e2..cb30d1a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -2499,4 +2499,6 @@ void bnx2x_set_local_cmng(struct bnx2x *bp);
#define MCPR_SCRATCH_BASE(bp) \
(CHIP_IS_E1x(bp) ? MCP_REG_MCPR_SCRATCH : MCP_A_REG_MCPR_SCRATCH)
+#define E1H_MAX_MF_SB_COUNT (HC_SB_MAX_SB_E1X/(E1HVN_MAX * PORT_MAX))
+
#endif /* bnx2x.h */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 814d0ec..8b3107b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -11447,9 +11447,9 @@ static int bnx2x_get_hwinfo(struct bnx2x *bp)
}
}
- /* adjust igu_sb_cnt to MF for E1x */
- if (CHIP_IS_E1x(bp) && IS_MF(bp))
- bp->igu_sb_cnt /= E1HVN_MAX;
+ /* adjust igu_sb_cnt to MF for E1H */
+ if (CHIP_IS_E1H(bp) && IS_MF(bp))
+ bp->igu_sb_cnt = min_t(u8, bp->igu_sb_cnt, E1H_MAX_MF_SB_COUNT);
/* port info */
bnx2x_get_port_hwinfo(bp);
--
1.8.1.227.g44fe835
next prev parent reply other threads:[~2014-01-05 16:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-05 16:33 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
2014-01-05 16:33 ` Yuval Mintz [this message]
2014-01-06 13:47 ` [PATCH net 1/5] bnx2x: limit number of interrupt vectors for 57711 Sergei Shtylyov
2014-01-05 16:33 ` [PATCH net 2/5] bnx2x: Correct number of MSI-X vectors for VFs Yuval Mintz
2014-01-06 16:28 ` [BUG] bnx2x : lockdep assertion Eric Dumazet
2014-01-06 16:35 ` Ariel Elior
2014-01-06 16:49 ` Eric Dumazet
2014-01-05 16:33 ` [PATCH net 3/5] bnx2x: Clean before update RSS arrives Yuval Mintz
2014-01-05 16:33 ` [PATCH net 4/5] bnx2x: fix AFEX memory overflow Yuval Mintz
2014-01-05 16:33 ` [PATCH net 5/5] bnx2x: fix VLAN configuration for VFs Yuval Mintz
2014-01-05 19:19 ` Or Gerlitz
2014-01-05 19:24 ` Yuval Mintz
2014-01-06 1:23 ` [PATCH net 0/5] bnx2x: Bug fixes patch series David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388939634-19948-2-git-send-email-yuvalmin@broadcom.com \
--to=yuvalmin@broadcom.com \
--cc=ariele@broadcom.com \
--cc=davem@davemloft.net \
--cc=dmitry@broadcom.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).