netlink: let core handle error cases in dump operations
After commit b5a899154aa9 ("netlink: handle EMSGSIZE errors in the core"), we can remove some code that was not 100 % correct anyway. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20240306102426.245689-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
4af9a0bee1
commit
02e24903e5
@ -2267,11 +2267,8 @@ walk_entries:
|
|||||||
nlh->nlmsg_seq, 0, flags,
|
nlh->nlmsg_seq, 0, flags,
|
||||||
ext_filter_mask, 0, NULL, 0,
|
ext_filter_mask, 0, NULL, 0,
|
||||||
netnsid, GFP_KERNEL);
|
netnsid, GFP_KERNEL);
|
||||||
if (err < 0) {
|
if (err < 0)
|
||||||
if (likely(skb->len))
|
|
||||||
err = skb->len;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
cb->seq = tgt_net->dev_base_seq;
|
cb->seq = tgt_net->dev_base_seq;
|
||||||
nl_dump_check_consistent(cb, nlmsg_hdr(skb));
|
nl_dump_check_consistent(cb, nlmsg_hdr(skb));
|
||||||
|
@ -1900,8 +1900,6 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
if (err < 0 && likely(skb->len))
|
|
||||||
err = skb->len;
|
|
||||||
if (fillargs.netnsid >= 0)
|
if (fillargs.netnsid >= 0)
|
||||||
put_net(tgt_net);
|
put_net(tgt_net);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
@ -2312,8 +2310,6 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb,
|
|||||||
ctx->all_default++;
|
ctx->all_default++;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
if (err < 0 && likely(skb->len))
|
|
||||||
err = skb->len;
|
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -1026,8 +1026,6 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
err = fib_table_dump(tb, skb, cb, &filter);
|
err = fib_table_dump(tb, skb, cb, &filter);
|
||||||
if (err < 0 && skb->len)
|
|
||||||
err = skb->len;
|
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1045,11 +1043,8 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
memset(&cb->args[2], 0, sizeof(cb->args) -
|
memset(&cb->args[2], 0, sizeof(cb->args) -
|
||||||
2 * sizeof(cb->args[0]));
|
2 * sizeof(cb->args[0]));
|
||||||
err = fib_table_dump(tb, skb, cb, &filter);
|
err = fib_table_dump(tb, skb, cb, &filter);
|
||||||
if (err < 0) {
|
if (err < 0)
|
||||||
if (likely(skb->len))
|
|
||||||
err = skb->len;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
dumped = 1;
|
dumped = 1;
|
||||||
next:
|
next:
|
||||||
e++;
|
e++;
|
||||||
|
@ -793,8 +793,6 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb,
|
|||||||
ctx->all_default++;
|
ctx->all_default++;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
if (err < 0 && likely(skb->len))
|
|
||||||
err = skb->len;
|
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -6158,11 +6156,8 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
NETLINK_CB(cb->skb).portid,
|
NETLINK_CB(cb->skb).portid,
|
||||||
cb->nlh->nlmsg_seq,
|
cb->nlh->nlmsg_seq,
|
||||||
RTM_NEWLINK, NLM_F_MULTI);
|
RTM_NEWLINK, NLM_F_MULTI);
|
||||||
if (err < 0) {
|
if (err < 0)
|
||||||
if (likely(skb->len))
|
|
||||||
err = skb->len;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user