DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, stable@dpdk.org,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	 Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Subject: Re: [RFC 4/7] net/bnxt: fix use after free
Date: Mon, 27 Jan 2025 11:25:30 -0800	[thread overview]
Message-ID: <CACZ4nhtqve6nGZnWKK5oumF0dizwinFP1xNVymzN4FOzTi2RnA@mail.gmail.com> (raw)
In-Reply-To: <20250127180842.97907-5-stephen@networkplumber.org>

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

On Mon, Jan 27, 2025 at 10:08 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The filter cleanup loop was using STAILQ_FOREACH and rte_free
> and would dereference the filter after free.
>
> Found by build with -Dbsanitize=address,undefined
>
> Fixes: e8fe0e067b68 ("net/bnxt: fix allocation of PF info struct")
> Cc: ajit.khaparde@broadcom.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_filter.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
> index 7b90ba651f..f083f3aa94 100644
> --- a/drivers/net/bnxt/bnxt_filter.c
> +++ b/drivers/net/bnxt/bnxt_filter.c
> @@ -3,14 +3,12 @@
>   * All rights reserved.
>   */
>
> -#include <sys/queue.h>
> -
>  #include <rte_byteorder.h>
>  #include <rte_log.h>
>  #include <rte_malloc.h>
>  #include <rte_flow.h>
>  #include <rte_flow_driver.h>
> -#include <rte_tailq.h>
> +#include <rte_queue.h>
>
>  #include "bnxt.h"
>  #include "bnxt_filter.h"
> @@ -151,7 +149,9 @@ void bnxt_free_filter_mem(struct bnxt *bp)
>         bp->filter_info = NULL;
>
>         for (i = 0; i < bp->pf->max_vfs; i++) {
> -               STAILQ_FOREACH(filter, &bp->pf->vf_info[i].filter, next) {
> +               struct bnxt_filter_info *tmp;
> +
> +               STAILQ_FOREACH_SAFE(filter, &bp->pf->vf_info[i].filter, next, tmp) {
>                         rte_free(filter);
>                         STAILQ_REMOVE(&bp->pf->vf_info[i].filter, filter,
>                                       bnxt_filter_info, next);
> --
> 2.45.2
>

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

  reply	other threads:[~2025-01-27 19:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27 18:03 [RFC 0/7] Introduce FreeBSD macros for SAFE iteration Stephen Hemminger
2025-01-27 18:03 ` [RFC 1/7] eal: add queue macro extensions from FreeBSD Stephen Hemminger
2025-01-27 18:03 ` [RFC 2/7] net/qede: fix use after free Stephen Hemminger
2025-01-27 18:03 ` [RFC 3/7] bus/fslmc: " Stephen Hemminger
2025-01-27 18:03 ` [RFC 4/7] net/bnxt: " Stephen Hemminger
2025-01-27 19:25   ` Ajit Khaparde [this message]
2025-01-27 18:03 ` [RFC 5/7] net/iavf: replace local version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-01-27 18:04 ` [RFC 6/7] vhost: replace open coded TAILQ_FOREACH_SAFE Stephen Hemminger
2025-01-27 18:04 ` [RFC 7/7] raw/ifpga: use EAL version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-01-27 18:16 ` [RFC 0/7] Introduce FreeBSD macros for SAFE iteration Bruce Richardson
2025-01-27 18:43   ` Stephen Hemminger
2025-01-27 19:29     ` Morten Brørup
2025-01-27 23:14       ` Stephen Hemminger

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=CACZ4nhtqve6nGZnWKK5oumF0dizwinFP1xNVymzN4FOzTi2RnA@mail.gmail.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.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).