* [PATCH v1] net/ethtool/tunnels: check the return value of nla_nest_start()
@ 2022-09-17 2:26 Li Zhong
2022-09-20 18:37 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Li Zhong @ 2022-09-17 2:26 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: pabeni, kuba, edumazet, davem, Li Zhong
Check the return value of nla_nest_start(), which could be NULL on
error.
Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
net/ethtool/tunnels.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ethtool/tunnels.c b/net/ethtool/tunnels.c
index efde33536687..90974b625cf6 100644
--- a/net/ethtool/tunnels.c
+++ b/net/ethtool/tunnels.c
@@ -136,6 +136,8 @@ ethnl_tunnel_info_fill_reply(const struct ethnl_req_info *req_base,
goto err_cancel_table;
entry = nla_nest_start(skb, ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY);
+ if (!entry)
+ return -EMSGSIZE;
if (nla_put_be16(skb, ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT,
htons(IANA_VXLAN_UDP_PORT)) ||
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] net/ethtool/tunnels: check the return value of nla_nest_start()
2022-09-17 2:26 [PATCH v1] net/ethtool/tunnels: check the return value of nla_nest_start() Li Zhong
@ 2022-09-20 18:37 ` Jakub Kicinski
2022-09-20 19:31 ` Li Zhong
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2022-09-20 18:37 UTC (permalink / raw)
To: Li Zhong; +Cc: linux-kernel, netdev, pabeni, edumazet, davem
On Fri, 16 Sep 2022 19:26:02 -0700 Li Zhong wrote:
> goto err_cancel_table;
>
> entry = nla_nest_start(skb, ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY);
> + if (!entry)
> + return -EMSGSIZE;
not even correct, and completely harmless
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] net/ethtool/tunnels: check the return value of nla_nest_start()
2022-09-20 18:37 ` Jakub Kicinski
@ 2022-09-20 19:31 ` Li Zhong
2022-09-20 19:41 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Li Zhong @ 2022-09-20 19:31 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: linux-kernel, netdev, pabeni, edumazet, davem
On Tue, Sep 20, 2022 at 11:37 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 16 Sep 2022 19:26:02 -0700 Li Zhong wrote:
> > goto err_cancel_table;
> >
> > entry = nla_nest_start(skb, ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY);
> > + if (!entry)
> > + return -EMSGSIZE;
>
> not even correct, and completely harmless
Thanks for your reply. Maybe a more suitable way of error handling is 'goto
err_cancel_table;'?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] net/ethtool/tunnels: check the return value of nla_nest_start()
2022-09-20 19:31 ` Li Zhong
@ 2022-09-20 19:41 ` Jakub Kicinski
2022-09-21 8:31 ` Li Zhong
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2022-09-20 19:41 UTC (permalink / raw)
To: Li Zhong; +Cc: linux-kernel, netdev, pabeni, edumazet, davem
On Tue, 20 Sep 2022 12:31:29 -0700 Li Zhong wrote:
> On Tue, Sep 20, 2022 at 11:37 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > On Fri, 16 Sep 2022 19:26:02 -0700 Li Zhong wrote:
> > > goto err_cancel_table;
> > >
> > > entry = nla_nest_start(skb, ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY);
> > > + if (!entry)
> > > + return -EMSGSIZE;
> >
> > not even correct, and completely harmless
>
> Thanks for your reply. Maybe a more suitable way of error handling is 'goto
> err_cancel_table;'?
Yes, but you _most_ provide the detailed analysis of the impact
in the commit message for the patches to be considered for merging.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] net/ethtool/tunnels: check the return value of nla_nest_start()
2022-09-20 19:41 ` Jakub Kicinski
@ 2022-09-21 8:31 ` Li Zhong
0 siblings, 0 replies; 5+ messages in thread
From: Li Zhong @ 2022-09-21 8:31 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: linux-kernel, netdev, pabeni, edumazet, davem
On Tue, Sep 20, 2022 at 12:41 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Tue, 20 Sep 2022 12:31:29 -0700 Li Zhong wrote:
> > On Tue, Sep 20, 2022 at 11:37 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > > On Fri, 16 Sep 2022 19:26:02 -0700 Li Zhong wrote:
> > > > goto err_cancel_table;
> > > >
> > > > entry = nla_nest_start(skb, ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY);
> > > > + if (!entry)
> > > > + return -EMSGSIZE;
> > >
> > > not even correct, and completely harmless
> >
> > Thanks for your reply. Maybe a more suitable way of error handling is 'goto
> > err_cancel_table;'?
>
> Yes, but you _most_ provide the detailed analysis of the impact
> in the commit message for the patches to be considered for merging.
Thanks for the suggestion. The commit message is updated with more details.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-21 8:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17 2:26 [PATCH v1] net/ethtool/tunnels: check the return value of nla_nest_start() Li Zhong
2022-09-20 18:37 ` Jakub Kicinski
2022-09-20 19:31 ` Li Zhong
2022-09-20 19:41 ` Jakub Kicinski
2022-09-21 8:31 ` Li Zhong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).