[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <21a41a1c-4ae4-47c7-c608-b6dd82758b16@molgen.mpg.de>
Date: Wed, 25 Jan 2023 21:09:39 +0100
From: Paul Menzel <pmenzel@...gen.mpg.de>
To: Natalia Petrova <n.petrova@...tech.ru>
Cc: Jesse Brandeburg <jesse.brandeburg@...el.com>,
lvc-project@...uxtesting.org, intel-wired-lan@...ts.osuosl.org,
linux-kernel@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [Intel-wired-lan] [PATCH] i40e: Add checking for null for
nlmsg_find_attr()
Dear Natalia,
Thank you for your patch.
Am 25.01.23 um 15:13 schrieb Natalia Petrova:
In the commit message summary, you could use:
Check if nlmsg_find_attr() returns null
> The result of nlmsg_find_attr() 'br_spec' is dereferenced in
> nla_for_each_nested, but it can take null value in 'nla_find' finction,
f*u*nction
> which will result in an error.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 51616018dd1b ("i40e: Add support for getlink, setlink ndo ops")
> Signed-off-by: Natalia Petrova <n.petrova@...tech.ru>
> ---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index b36bf9c3e1e4..ed4be4ffeb09 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -13101,6 +13101,8 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
> }
>
> br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);
> + if (!br_spec)
> + return -ENOENT;
>
> nla_for_each_nested(attr, br_spec, rem) {
> __u16 mode;
Kind regards,
Paul
Powered by blists - more mailing lists