* [PATCH v3] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg()
@ 2022-08-02 4:08 Mao YingMing
2022-08-02 4:09 ` Somnath Kotur
0 siblings, 1 reply; 4+ messages in thread
From: Mao YingMing @ 2022-08-02 4:08 UTC (permalink / raw)
To: dev; +Cc: Ajit Khaparde, Somnath Kotur, Kalesh AP, Thomas Monjalon
For VFs, bp->leds is uninitialized, check bp->leds is
not null before checking for bp->leds->num_leds.
segfault backtrace in trex program when use VF:
11: bnxt_hwrm_port_led_cfg (bp=0x23ffb2140, led_on=true)
10: bnxt_dev_led_on_op (dev=0x22d7780 <rte_eth_devices>)
9: rte_eth_led_on (port_id=0)
8: DpdkTRexPortAttr::set_led (this=0x23b6ce0, on=true)
7: DpdkTRexPortAttr::DpdkTRexPortAttr
6: CTRexExtendedDriverBnxt::create_port_attr
5: CPhyEthIF::Create
4: CGlobalTRex::device_start
3: CGlobalTRex::Create
2: main_test
1: main
Fixes: d4d5a04 ("net/bnxt: fix unnecessary memory allocation")
Cc: stable@dpdk.org
Signed-off-by: Mao YingMing <maoyingming@baidu.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 9c52573..51e1e2d 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4535,7 +4535,7 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
uint16_t duration = 0;
int rc, i;
- if (!bp->leds->num_leds || BNXT_VF(bp))
+ if (BNXT_VF(bp) || !bp->leds || !bp->leds->num_leds)
return -EOPNOTSUPP;
HWRM_PREP(&req, HWRM_PORT_LED_CFG, BNXT_USE_CHIMP_MB);
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg()
2022-08-02 4:08 [PATCH v3] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg() Mao YingMing
@ 2022-08-02 4:09 ` Somnath Kotur
2022-08-02 4:14 ` 答复: " Mao,Yingming
0 siblings, 1 reply; 4+ messages in thread
From: Somnath Kotur @ 2022-08-02 4:09 UTC (permalink / raw)
To: Mao YingMing; +Cc: dev, Ajit Khaparde, Kalesh AP, Thomas Monjalon
[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]
On Tue, Aug 2, 2022 at 9:38 AM Mao YingMing <maoyingming@baidu.com> wrote:
>
> For VFs, bp->leds is uninitialized, check bp->leds is
> not null before checking for bp->leds->num_leds.
>
> segfault backtrace in trex program when use VF:
> 11: bnxt_hwrm_port_led_cfg (bp=0x23ffb2140, led_on=true)
> 10: bnxt_dev_led_on_op (dev=0x22d7780 <rte_eth_devices>)
> 9: rte_eth_led_on (port_id=0)
> 8: DpdkTRexPortAttr::set_led (this=0x23b6ce0, on=true)
> 7: DpdkTRexPortAttr::DpdkTRexPortAttr
> 6: CTRexExtendedDriverBnxt::create_port_attr
> 5: CPhyEthIF::Create
> 4: CGlobalTRex::device_start
> 3: CGlobalTRex::Create
> 2: main_test
> 1: main
>
> Fixes: d4d5a04 ("net/bnxt: fix unnecessary memory allocation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Mao YingMing <maoyingming@baidu.com>
> ---
> drivers/net/bnxt/bnxt_hwrm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
> index 9c52573..51e1e2d 100644
> --- a/drivers/net/bnxt/bnxt_hwrm.c
> +++ b/drivers/net/bnxt/bnxt_hwrm.c
> @@ -4535,7 +4535,7 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
> uint16_t duration = 0;
> int rc, i;
>
> - if (!bp->leds->num_leds || BNXT_VF(bp))
> + if (BNXT_VF(bp) || !bp->leds || !bp->leds->num_leds)
> return -EOPNOTSUPP;
>
> HWRM_PREP(&req, HWRM_PORT_LED_CFG, BNXT_USE_CHIMP_MB);
> --
> 1.8.3.1
>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* 答复: [PATCH v3] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg()
2022-08-02 4:09 ` Somnath Kotur
@ 2022-08-02 4:14 ` Mao,Yingming
2022-10-04 3:35 ` Ajit Khaparde
0 siblings, 1 reply; 4+ messages in thread
From: Mao,Yingming @ 2022-08-02 4:14 UTC (permalink / raw)
To: Somnath Kotur; +Cc: dev, Ajit Khaparde, Kalesh AP, Thomas Monjalon
Thans for your review.
Mao Yingming
-----邮件原件-----
发件人: Somnath Kotur <somnath.kotur@broadcom.com>
发送时间: 2022年8月2日 12:09
收件人: Mao,Yingming <maoyingming@baidu.com>
抄送: dev@dpdk.org; Ajit Khaparde <ajit.khaparde@broadcom.com>; Kalesh AP <kalesh-anakkur.purayil@broadcom.com>; Thomas Monjalon <thomas@monjalon.net>
主题: Re: [PATCH v3] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg()
On Tue, Aug 2, 2022 at 9:38 AM Mao YingMing <maoyingming@baidu.com> wrote:
>
> For VFs, bp->leds is uninitialized, check bp->leds is
> not null before checking for bp->leds->num_leds.
>
> segfault backtrace in trex program when use VF:
> 11: bnxt_hwrm_port_led_cfg (bp=0x23ffb2140, led_on=true)
> 10: bnxt_dev_led_on_op (dev=0x22d7780 <rte_eth_devices>)
> 9: rte_eth_led_on (port_id=0)
> 8: DpdkTRexPortAttr::set_led (this=0x23b6ce0, on=true)
> 7: DpdkTRexPortAttr::DpdkTRexPortAttr
> 6: CTRexExtendedDriverBnxt::create_port_attr
> 5: CPhyEthIF::Create
> 4: CGlobalTRex::device_start
> 3: CGlobalTRex::Create
> 2: main_test
> 1: main
>
> Fixes: d4d5a04 ("net/bnxt: fix unnecessary memory allocation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Mao YingMing <maoyingming@baidu.com>
> ---
> drivers/net/bnxt/bnxt_hwrm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
> index 9c52573..51e1e2d 100644
> --- a/drivers/net/bnxt/bnxt_hwrm.c
> +++ b/drivers/net/bnxt/bnxt_hwrm.c
> @@ -4535,7 +4535,7 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
> uint16_t duration = 0;
> int rc, i;
>
> - if (!bp->leds->num_leds || BNXT_VF(bp))
> + if (BNXT_VF(bp) || !bp->leds || !bp->leds->num_leds)
> return -EOPNOTSUPP;
>
> HWRM_PREP(&req, HWRM_PORT_LED_CFG, BNXT_USE_CHIMP_MB);
> --
> 1.8.3.1
>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg()
2022-08-02 4:14 ` 答复: " Mao,Yingming
@ 2022-10-04 3:35 ` Ajit Khaparde
0 siblings, 0 replies; 4+ messages in thread
From: Ajit Khaparde @ 2022-10-04 3:35 UTC (permalink / raw)
To: Mao,Yingming; +Cc: Somnath Kotur, dev, Kalesh AP, Thomas Monjalon
[-- Attachment #1: Type: text/plain, Size: 2320 bytes --]
On Mon, Aug 1, 2022 at 9:15 PM Mao,Yingming <maoyingming@baidu.com> wrote:
>
> Thans for your review.
> Mao Yingming
>
> -----邮件原件-----
> 发件人: Somnath Kotur <somnath.kotur@broadcom.com>
> 发送时间: 2022年8月2日 12:09
> 收件人: Mao,Yingming <maoyingming@baidu.com>
> 抄送: dev@dpdk.org; Ajit Khaparde <ajit.khaparde@broadcom.com>; Kalesh AP <kalesh-anakkur.purayil@broadcom.com>; Thomas Monjalon <thomas@monjalon.net>
> 主题: Re: [PATCH v3] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg()
>
> On Tue, Aug 2, 2022 at 9:38 AM Mao YingMing <maoyingming@baidu.com> wrote:
> >
> > For VFs, bp->leds is uninitialized, check bp->leds is
> > not null before checking for bp->leds->num_leds.
> >
> > segfault backtrace in trex program when use VF:
> > 11: bnxt_hwrm_port_led_cfg (bp=0x23ffb2140, led_on=true)
> > 10: bnxt_dev_led_on_op (dev=0x22d7780 <rte_eth_devices>)
> > 9: rte_eth_led_on (port_id=0)
> > 8: DpdkTRexPortAttr::set_led (this=0x23b6ce0, on=true)
> > 7: DpdkTRexPortAttr::DpdkTRexPortAttr
> > 6: CTRexExtendedDriverBnxt::create_port_attr
> > 5: CPhyEthIF::Create
> > 4: CGlobalTRex::device_start
> > 3: CGlobalTRex::Create
> > 2: main_test
> > 1: main
> >
> > Fixes: d4d5a04 ("net/bnxt: fix unnecessary memory allocation")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Mao YingMing <maoyingming@baidu.com>
> > ---
> > drivers/net/bnxt/bnxt_hwrm.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
> > index 9c52573..51e1e2d 100644
> > --- a/drivers/net/bnxt/bnxt_hwrm.c
> > +++ b/drivers/net/bnxt/bnxt_hwrm.c
> > @@ -4535,7 +4535,7 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
> > uint16_t duration = 0;
> > int rc, i;
> >
> > - if (!bp->leds->num_leds || BNXT_VF(bp))
> > + if (BNXT_VF(bp) || !bp->leds || !bp->leds->num_leds)
> > return -EOPNOTSUPP;
> >
> > HWRM_PREP(&req, HWRM_PORT_LED_CFG, BNXT_USE_CHIMP_MB);
> > --
> > 1.8.3.1
> >
> Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Patch merged in dpdk-next-net-brcm
Modified the commit headline to
net/bnxt: fix null pointer dereference.
Thanks
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-04 3:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 4:08 [PATCH v3] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg() Mao YingMing
2022-08-02 4:09 ` Somnath Kotur
2022-08-02 4:14 ` 答复: " Mao,Yingming
2022-10-04 3:35 ` Ajit Khaparde
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).