diff mbox series

[net-next,v2] rtnetlink: Move nesting cancellation rollback to proper function

Message ID 20230716072440.2372567-1-gal@nvidia.com (mailing list archive)
State Accepted
Commit 4a59cdfd66998259061b86437b9439d186f89d5a
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] rtnetlink: Move nesting cancellation rollback to proper function | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1344 this patch: 1344
netdev/cc_maintainers warning 4 maintainers not CCed: razor@blackwall.org idosch@nvidia.com edwin.peer@broadcom.com lucien.xin@gmail.com
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1367 this patch: 1367
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 34 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Gal Pressman July 16, 2023, 7:24 a.m. UTC
Make rtnl_fill_vf() cancel the vfinfo attribute on error instead of the
inner rtnl_fill_vfinfo(), as it is the function that starts it.

Signed-off-by: Gal Pressman <gal@nvidia.com>
---
Changelog -
v1->v2: https://lore.kernel.org/all/20230713141652.2288309-1-gal@nvidia.com/
* Remove unused vfinfo parameter (Simon)
---
 net/core/rtnetlink.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Paolo Abeni July 18, 2023, 10:59 a.m. UTC | #1
Hi,

On Sun, 2023-07-16 at 10:24 +0300, Gal Pressman wrote:
> Make rtnl_fill_vf() cancel the vfinfo attribute on error instead of the
> inner rtnl_fill_vfinfo(), as it is the function that starts it.
> 
> Signed-off-by: Gal Pressman <gal@nvidia.com>

This looks like -net material to me (except for the missing fixes tag).
Any special reason to target net-next? 

Thanks!

Paolo
Gal Pressman July 18, 2023, 11:10 a.m. UTC | #2
On 18/07/2023 13:59, Paolo Abeni wrote:
> Hi,
> 
> On Sun, 2023-07-16 at 10:24 +0300, Gal Pressman wrote:
>> Make rtnl_fill_vf() cancel the vfinfo attribute on error instead of the
>> inner rtnl_fill_vfinfo(), as it is the function that starts it.
>>
>> Signed-off-by: Gal Pressman <gal@nvidia.com>
> 
> This looks like -net material to me (except for the missing fixes tag).
> Any special reason to target net-next? 
> 
> Thanks!
> 
> Paolo
> 

Hi Paolo,
This doesn't fix any real bug, it's a cleanup, hence the net-next targeting.
patchwork-bot+netdevbpf@kernel.org July 18, 2023, 1:20 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Sun, 16 Jul 2023 10:24:40 +0300 you wrote:
> Make rtnl_fill_vf() cancel the vfinfo attribute on error instead of the
> inner rtnl_fill_vfinfo(), as it is the function that starts it.
> 
> Signed-off-by: Gal Pressman <gal@nvidia.com>
> ---
> Changelog -
> v1->v2: https://lore.kernel.org/all/20230713141652.2288309-1-gal@nvidia.com/
> * Remove unused vfinfo parameter (Simon)
> 
> [...]

Here is the summary with links:
  - [net-next,v2] rtnetlink: Move nesting cancellation rollback to proper function
    https://git.kernel.org/netdev/net-next/c/4a59cdfd6699

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 3ad4e030846d..70838d7e5b32 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1273,7 +1273,6 @@  static noinline_for_stack int rtnl_fill_stats(struct sk_buff *skb,
 static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
 					       struct net_device *dev,
 					       int vfs_num,
-					       struct nlattr *vfinfo,
 					       u32 ext_filter_mask)
 {
 	struct ifla_vf_rss_query_en vf_rss_query_en;
@@ -1343,7 +1342,7 @@  static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
 	vf_trust.setting = ivi.trusted;
 	vf = nla_nest_start_noflag(skb, IFLA_VF_INFO);
 	if (!vf)
-		goto nla_put_vfinfo_failure;
+		return -EMSGSIZE;
 	if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) ||
 	    nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast), &vf_broadcast) ||
 	    nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) ||
@@ -1414,8 +1413,6 @@  static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
 
 nla_put_vf_failure:
 	nla_nest_cancel(skb, vf);
-nla_put_vfinfo_failure:
-	nla_nest_cancel(skb, vfinfo);
 	return -EMSGSIZE;
 }
 
@@ -1441,8 +1438,10 @@  static noinline_for_stack int rtnl_fill_vf(struct sk_buff *skb,
 		return -EMSGSIZE;
 
 	for (i = 0; i < num_vfs; i++) {
-		if (rtnl_fill_vfinfo(skb, dev, i, vfinfo, ext_filter_mask))
+		if (rtnl_fill_vfinfo(skb, dev, i, ext_filter_mask)) {
+			nla_nest_cancel(skb, vfinfo);
 			return -EMSGSIZE;
+		}
 	}
 
 	nla_nest_end(skb, vfinfo);