DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: Mao YingMing <maoyingming@baidu.com>
Cc: dev@dpdk.org, Ajit Khaparde <ajit.khaparde@broadcom.com>,
	 Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [PATCH] net/bnxt: fix null pointer dereference in bnxt_hwrm_port_led_cfg()
Date: Tue, 2 Aug 2022 08:36:49 +0530	[thread overview]
Message-ID: <CAOBf=mskW-YzwTT1LcM6aLA7Y4m=mo_NY7DTMA6hUszV9joSkg@mail.gmail.com> (raw)
In-Reply-To: <1659409422-6822-1-git-send-email-maoyingming@baidu.com>

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

On Tue, Aug 2, 2022 at 8:33 AM Mao YingMing <maoyingming@baidu.com> wrote:
>
Thanks for the patch
> From: maoyingming <maoyingming@baidu.com>
>
> VFs's "bp->leds" is allways null, check bp->leds is
> not null before use bp->leds->num_leds.
Typo in 'always'
You can just say ' For VFs , bp->leds is uninitialized'
>
> 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..41e6067 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
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

  reply	other threads:[~2022-08-02  3:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  3:03 Mao YingMing
2022-08-02  3:06 ` Somnath Kotur [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-08-02  3:07 Mao YingMing
2022-08-01 14:50 Mao YingMing
2022-08-01 14:47 Mao YingMing

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='CAOBf=mskW-YzwTT1LcM6aLA7Y4m=mo_NY7DTMA6hUszV9joSkg@mail.gmail.com' \
    --to=somnath.kotur@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=maoyingming@baidu.com \
    --cc=thomas@monjalon.net \
    /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).