From: Jacob Keller <jacob.e.keller@intel.com>
To: Elad Nachman <enachman@marvell.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <yevhen.orlov@plvision.eu>,
<taras.chornyi@plvision.eu>, <oleksandr.mazur@plvision.eu>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH] net: prestera: return error on hash table init failure
Date: Tue, 15 Sep 2026 16:55:19 -0700 [thread overview]
Message-ID: <e942fc27-3179-42cc-83ca-d05393530136@intel.com> (raw)
In-Reply-To: <20260914112026.2822222-1-enachman@marvell.com>
On 9/14/2026 4:20 AM, Elad Nachman wrote:
> From: Elad Nachman <enachman@marvell.com>
>
> prestera_router_hw_init() calls rhashtable_destroy() on error but then
> still returns success. This causes prestera_router_init() to continue
> without error, going through line 1623, and call
> prestera_router_hw_fini(sw), which will cause dereferencing of freed memory
> 'sw->router->nexthop_group_ht.tbl' at line 1560.
>
> Fixes: 0a23ae237171 ("net: marvell: prestera: Add router nexthops ABI")
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://lore.kernel.org/kernel-janitors/aqT9h61WBcslE0gJ@stanley.mountain
> Signed-off-by: Elad Nachman <enachman@marvell.com>
> ---
> drivers/net/ethernet/marvell/prestera/prestera_router_hw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c b/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
> index ccf6cf98920f..4785fcb62735 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
> @@ -93,7 +93,7 @@ int prestera_router_hw_init(struct prestera_switch *sw)
> err_nexthop_grp_ht_init:
> rhashtable_destroy(&sw->router->nh_neigh_ht);
> err_nh_neigh_ht_init:
> - return 0;
> + return err;
> }
>
It looks like this snuck in because the original
prestera_router_hw_init() implementation didn't have any failure path
and always returned 0. Then commit 0a23ae237171 ("net: marvell:
prestera: Add router nexthops ABI") added some errors with handling but
did not report the error. Makes sense.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> void prestera_router_hw_fini(struct prestera_switch *sw)
next prev parent reply other threads:[~2026-09-15 23:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 11:20 Elad Nachman
2026-09-15 23:55 ` Jacob Keller [this message]
2026-09-16 1:35 ` netdev-bot+sashiko
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=e942fc27-3179-42cc-83ca-d05393530136@intel.com \
--to=jacob.e.keller@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=enachman@marvell.com \
--cc=error27@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oleksandr.mazur@plvision.eu \
--cc=pabeni@redhat.com \
--cc=taras.chornyi@plvision.eu \
--cc=yevhen.orlov@plvision.eu \
/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®