[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8/O4tf53ZemTABX@unreal>
Date: Tue, 24 Jan 2023 14:28:18 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Vladimir Oltean <vladimir.oltean@....com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Michal Kubecek <mkubecek@...e.cz>
Subject: Re: [PATCH net-next] net: ethtool: fix NULL pointer dereference in
stats_prepare_data()
On Tue, Jan 24, 2023 at 01:08:01PM +0200, Vladimir Oltean wrote:
> In the following call path:
>
> ethnl_default_dumpit
> -> ethnl_default_dump_one
> -> ctx->ops->prepare_data
> -> stats_prepare_data
>
> struct genl_info *info will be passed as NULL, and stats_prepare_data()
> dereferences it while getting the extended ack pointer.
>
> To avoid that, just set the extack to NULL if "info" is NULL, since the
> netlink extack handling messages know how to deal with that.
>
> The pattern "info ? info->extack : NULL" is present in quite a few other
> "prepare_data" implementations, so it's clear that it's a more general
> problem to be dealt with at a higher level, but the code should have at
> least adhered to the current conventions to avoid the NULL dereference.
>
> Fixes: 04692c9020b7 ("net: ethtool: netlink: retrieve stats from multiple sources (eMAC, pMAC)")
> Reported-by: Eric Dumazet <edumazet@...gle.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
> net/ethtool/stats.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@...dia.com>
Powered by blists - more mailing lists