* fix for bnx2x panic during ethtool reporting
@ 2018-04-17 17:21 Sebastian Kuzminsky
2018-04-17 23:42 ` Florian Fainelli
0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Kuzminsky @ 2018-04-17 17:21 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 267 bytes --]
"ethtool -i" on a bnx2x interface causes kernel panic when the
firmware version is longer than expected. The attached patch fixes
the problem by simplifying the string handling in bnx2x_fill_fw_str().
It applies cleanly to 4.14 and 4.17-rc1.
--
Sebastian Kuzminsky
[-- Attachment #2: 0001-bnx2x-make-fw-str-in-a-non-crazy-way.patch --]
[-- Type: text/x-patch, Size: 1236 bytes --]
From 76ad7a41e84674519d2d5f47e42c84697ea3f23c Mon Sep 17 00:00:00 2001
From: Sebastian Kuzminsky <seb@highlab.com>
Date: Mon, 16 Apr 2018 23:24:07 +0000
Subject: [PATCH] bnx2x: make fw str in a non-crazy way
This fixes an unterminated string bug when the firwmare version
(bp->fw_ver) is longer than the passed-in buffer (buf/buf_len).
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 67fe3d826566..5534cee0aab8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -150,9 +150,9 @@ void bnx2x_fill_fw_str(struct bnx2x *bp, char *buf, size_t buf_len)
phy_fw_ver[0] = '\0';
bnx2x_get_ext_phy_fw_version(&bp->link_params,
phy_fw_ver, PHY_FW_VER_LEN);
- strlcpy(buf, bp->fw_ver, buf_len);
- snprintf(buf + strlen(bp->fw_ver), 32 - strlen(bp->fw_ver),
- "bc %d.%d.%d%s%s",
+ snprintf(buf, buf_len,
+ "%s bc %d.%d.%d%s%s",
+ bp->fw_ver,
(bp->common.bc_ver & 0xff0000) >> 16,
(bp->common.bc_ver & 0xff00) >> 8,
(bp->common.bc_ver & 0xff),
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: fix for bnx2x panic during ethtool reporting
2018-04-17 17:21 fix for bnx2x panic during ethtool reporting Sebastian Kuzminsky
@ 2018-04-17 23:42 ` Florian Fainelli
2018-04-24 11:23 ` Kalluru, Sudarsana
0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2018-04-17 23:42 UTC (permalink / raw)
To: Sebastian Kuzminsky, linux-kernel, netdev, ariel.elior, everest-linux-l2
+netdev, Ariel,
On 04/17/2018 10:21 AM, Sebastian Kuzminsky wrote:
> "ethtool -i" on a bnx2x interface causes kernel panic when the
> firmware version is longer than expected. The attached patch fixes
> the problem by simplifying the string handling in bnx2x_fill_fw_str().
> It applies cleanly to 4.14 and 4.17-rc1.
If you want to have a chance of getting your patch included, your should
make sure you copy the driver maintainers and the network mailinglist,
doing that.
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: fix for bnx2x panic during ethtool reporting
2018-04-17 23:42 ` Florian Fainelli
@ 2018-04-24 11:23 ` Kalluru, Sudarsana
2018-04-24 17:22 ` Sebastian Kuzminsky
0 siblings, 1 reply; 4+ messages in thread
From: Kalluru, Sudarsana @ 2018-04-24 11:23 UTC (permalink / raw)
To: Florian Fainelli, Sebastian Kuzminsky, linux-kernel, netdev,
Elior, Ariel, Dept-Eng Everest Linux L2
-----Original Message-----
From: Florian Fainelli [mailto:f.fainelli@gmail.com]
Sent: 18 April 2018 05:12
To: Sebastian Kuzminsky <seb.kuzminsky@gmail.com>; linux-kernel@vger.kernel.org; netdev@vger.kernel.org; Elior, Ariel <Ariel.Elior@cavium.com>; Dept-Eng Everest Linux L2 <Dept-EngEverestLinuxL2@cavium.com>
Subject: Re: fix for bnx2x panic during ethtool reporting
+netdev, Ariel,
On 04/17/2018 10:21 AM, Sebastian Kuzminsky wrote:
> "ethtool -i" on a bnx2x interface causes kernel panic when the
> firmware version is longer than expected. The attached patch fixes
> the problem by simplifying the string handling in bnx2x_fill_fw_str().
> It applies cleanly to 4.14 and 4.17-rc1.
If you want to have a chance of getting your patch included, your should make sure you copy the driver maintainers and the network mailinglist, doing that.
--
Florian
Acked-by: Sudarsana Kalluru <Sudarsana.Kalluru@cavium.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fix for bnx2x panic during ethtool reporting
2018-04-24 11:23 ` Kalluru, Sudarsana
@ 2018-04-24 17:22 ` Sebastian Kuzminsky
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Kuzminsky @ 2018-04-24 17:22 UTC (permalink / raw)
To: Kalluru, Sudarsana
Cc: Florian Fainelli, linux-kernel, netdev, Elior, Ariel,
Dept-Eng Everest Linux L2
[-- Attachment #1: Type: text/plain, Size: 126 bytes --]
Here's an updated version of the patch that is checkpatch.pl clean (I
had forgotten to sign off...).
--
Sebastian Kuzminsky
[-- Attachment #2: 0001-bnx2x-make-fw-str-in-a-non-crazy-way.patch --]
[-- Type: text/x-patch, Size: 1290 bytes --]
From 45fe6fb1f6a187233bd1304b031bed20b3819d26 Mon Sep 17 00:00:00 2001
From: Sebastian Kuzminsky <seb@highlab.com>
Date: Mon, 16 Apr 2018 23:24:07 +0000
Subject: [PATCH] bnx2x: make fw str in a non-crazy way
This fixes an unterminated string bug when the firwmare version
(bp->fw_ver) is longer than the passed-in buffer (buf/buf_len).
Signed-off-by: Sebastian Kuzminsky <seb@highlab.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 6465414dad74..f023ee365c63 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -150,9 +150,9 @@ void bnx2x_fill_fw_str(struct bnx2x *bp, char *buf, size_t buf_len)
phy_fw_ver[0] = '\0';
bnx2x_get_ext_phy_fw_version(&bp->link_params,
phy_fw_ver, PHY_FW_VER_LEN);
- strlcpy(buf, bp->fw_ver, buf_len);
- snprintf(buf + strlen(bp->fw_ver), 32 - strlen(bp->fw_ver),
- "bc %d.%d.%d%s%s",
+ snprintf(buf, buf_len,
+ "%s bc %d.%d.%d%s%s",
+ bp->fw_ver,
(bp->common.bc_ver & 0xff0000) >> 16,
(bp->common.bc_ver & 0xff00) >> 8,
(bp->common.bc_ver & 0xff),
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-24 17:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 17:21 fix for bnx2x panic during ethtool reporting Sebastian Kuzminsky
2018-04-17 23:42 ` Florian Fainelli
2018-04-24 11:23 ` Kalluru, Sudarsana
2018-04-24 17:22 ` Sebastian Kuzminsky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.