Re: [PATCH] net: ice: Fix potential NULL pointer dereference in ice_bridge_setlink()

From: Simon Horman
Date: Fri Mar 01 2024 - 10:26:39 EST


On Wed, Feb 28, 2024 at 06:54:48PM +0300, Rand Deeb wrote:
> The function ice_bridge_setlink() may encounter a NULL pointer dereference
> if nlmsg_find_attr() returns NULL and br_spec is dereferenced subsequently
> in nla_for_each_nested(). To address this issue, add a check to ensure that
> br_spec is not NULL before proceeding with the nested attribute iteration.
>
> Signed-off-by: Rand Deeb <rand.sec96@xxxxxxxxx>

Thanks Rand,

I do wonder if for some reason this cannot ever occur.
But assuming it can then I agree with the fix.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>

As a fix I think it probably warrants a fixes tag and
being applied to net. As such, the following seems appropriate.

Fixes: b1edc14a3fbf ("ice: Implement ice_bridge_getlink and ice_bridge_setlink")

..