mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ratheesh Kannoth <rkannoth@marvell.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<donald.hunter@gmail.com>, <edumazet@google.com>,
	<horms@kernel.org>, <jiri@resnulli.us>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <sgoutham@marvell.com>
Subject: Re: [PATCH v18 net-next 5/8] octeontx2: cn20k: Coordinate default rules with NIX LF lifecycle
Date: Thu, 4 Jun 2026 08:11:34 +0530	[thread overview]
Message-ID: <aiDl3p5SYTd9vnd9@rkannoth-OptiPlex-7090> (raw)
In-Reply-To: <20260602060359.1894952-6-rkannoth@marvell.com>

On 2026-06-02 at 11:33:56, Ratheesh Kannoth (rkannoth@marvell.com) wrote:
> Add NIX_LF_DONT_FREE_DFT_IDXS so the PF can send NIX LF free during hw
> reinit or teardown without the AF freeing CN20K default NPC rule indexes
> while the driver still owns that state (otx2_init_hw_resources and
> otx2_free_hw_resources).
>
> On CN20K, allocate default NPC rules from NIX LF alloc before
> nix_interface_init, roll back with npc_cn20k_dft_rules_free on failure,
> and free from NIX LF free when the new flag is not set. Tighten
> rvu_mbox_handler_nix_lf_alloc error handling: use a single rc, propagate
> qmem_alloc and other errors, and set -ENOMEM only when kcalloc fails
> (remove the blanket -ENOMEM at the free_mem path).
>
> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>

https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260602060359.1894952-1-rkannoth%40marvell.com says:

>4. nix_interface_init() then calls
>   nix_update_mce_rule(NIXLF_BCAST_ENTRY, true), which can fail (for
>   example -EINVAL from npc_get_nixlf_mcam_index in the cn20k path,
>   or kzalloc failure in nix_update_mce_list).
>5. The new error path goto free_dft -> npc_cn20k_dft_rules_free()
>   walks mcam->mcam_rules and kfree()s every rule whose entry matches
>   one of the freed dft indexes, including the rule installed in
>   step 3.
>6. pfvf->def_ucast_rule is not cleared, so it now points at freed
>   memory.
>Subsequent mbox traffic for the same pcifunc dereferences that
>dangling pointer in places like:
If nix lf alloc fails, subsequent mbox traffic wont come for that Pcifunc.
Next nix_lf alloc, would alloc default mcam rules. Practically this is not possible.
I will add an hardening patchseries to remove the idempotency attribute of
npc_cn20k_dft_rules_alloc() after this series is merged.

  parent reply	other threads:[~2026-06-04  2:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  6:03 [PATCH v18 net-next 0/8] octeontx2-af: npc: Enhancements Ratheesh Kannoth
2026-06-02  6:03 ` [PATCH v18 net-next 1/8] octeontx2-af: npc: cn20k: debugfs enhancements Ratheesh Kannoth
2026-06-03  6:19   ` Ratheesh Kannoth
2026-06-04  2:19   ` Ratheesh Kannoth
2026-06-04 14:45     ` Jakub Kicinski
2026-06-05  2:07       ` Ratheesh Kannoth
2026-06-02  6:03 ` [PATCH v18 net-next 2/8] devlink: heap-allocate param fill buffers in devlink_nl_param_fill Ratheesh Kannoth
2026-06-02  6:03 ` [PATCH v18 net-next 3/8] devlink: Implement devlink param multi attribute nested data values Ratheesh Kannoth
2026-06-02  6:03 ` [PATCH v18 net-next 4/8] octeontx2-af: npc: cn20k: add subbank search order control Ratheesh Kannoth
2026-06-04  2:34   ` Ratheesh Kannoth
2026-06-02  6:03 ` [PATCH v18 net-next 5/8] octeontx2: cn20k: Coordinate default rules with NIX LF lifecycle Ratheesh Kannoth
2026-06-03  6:37   ` Ratheesh Kannoth
2026-06-04  2:41   ` Ratheesh Kannoth [this message]
2026-06-02  6:03 ` [PATCH v18 net-next 6/8] octeontx2-af: npc: Support for custom KPU profile from filesystem Ratheesh Kannoth
2026-06-03  6:46   ` Ratheesh Kannoth
2026-06-04  3:07   ` Ratheesh Kannoth
2026-06-02  6:03 ` [PATCH v18 net-next 7/8] octeontx2: cn20k: Respect NPC MCAM X2/X4 profile in flows and DFT alloc Ratheesh Kannoth
2026-06-03  6:54   ` Ratheesh Kannoth
2026-06-04  3:16   ` Ratheesh Kannoth
2026-06-02  6:03 ` [PATCH v18 net-next 8/8] octeontx2-af: npc: cn20k: Allocate npc_priv and dstats dynamically Ratheesh Kannoth
2026-06-03  7:03   ` Ratheesh Kannoth
2026-06-04  3:21   ` Ratheesh Kannoth

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=aiDl3p5SYTd9vnd9@rkannoth-OptiPlex-7090 \
    --to=rkannoth@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sgoutham@marvell.com \
    /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

all inboxes | Powered by JetHome®