[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aTB5h090Hu9BHFJ1@horms.kernel.org>
Date: Wed, 3 Dec 2025 17:55:19 +0000
From: Simon Horman <horms@...nel.org>
To: Petr Machata <petrm@...dia.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>, netdev@...r.kernel.org,
Ido Schimmel <idosch@...dia.com>, mlxsw@...dia.com,
Jiri Pirko <jiri@...nulli.us>
Subject: Re: [PATCH net 2/3] mlxsw: spectrum_router: Fix neighbour
use-after-free
On Tue, Dec 02, 2025 at 06:44:12PM +0100, Petr Machata wrote:
> From: Ido Schimmel <idosch@...dia.com>
>
> We sometimes observe use-after-free when dereferencing a neighbour [1].
> The problem seems to be that the driver stores a pointer to the
> neighbour, but without holding a reference on it. A reference is only
> taken when the neighbour is used by a nexthop.
>
> Fix by simplifying the reference counting scheme. Always take a
> reference when storing a neighbour pointer in a neighbour entry. Avoid
> taking a referencing when the neighbour is used by a nexthop as the
> neighbour entry associated with the nexthop already holds a reference.
>
> Tested by running the test that uncovered the problem over 300 times.
> Without this patch the problem was reproduced after a handful of
> iterations.
...
> Fixes: 6cf3c971dc84 ("mlxsw: spectrum_router: Add private neigh table")
> Signed-off-by: Ido Schimmel <idosch@...dia.com>
> Reviewed-by: Petr Machata <petrm@...dia.com>
> Signed-off-by: Petr Machata <petrm@...dia.com>
Reviewed-by: Simon Horman <horms@...nel.org>
...
Powered by blists - more mailing lists