Skip to content

Commit

Permalink
net: rtnl_dump_all needs to propagate error from dumpit function
Browse files Browse the repository at this point in the history
If an address, route or netconf dump request is sent for AF_UNSPEC, then
rtnl_dump_all is used to do the dump across all address families. If one
of the dumpit functions fails (e.g., invalid attributes in the dump
request) then rtnl_dump_all needs to propagate that error so the user
gets an appropriate response instead of just getting no data.

Fixes: effe679 ("net: Enable kernel side filtering of route dumps")
Fixes: 5fcd266 ("net/ipv4: Add support for dumping addresses for a specific device")
Fixes: 6371a71 ("net/ipv6: Add support for dumping addresses for a specific device")
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Ahern authored and David S. Miller committed Oct 24, 2018
1 parent ae677bb commit c63586d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -3333,6 +3333,7 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
int idx;
int s_idx = cb->family;
int type = cb->nlh->nlmsg_type - RTM_BASE;
int ret = 0;

if (s_idx == 0)
s_idx = 1;
Expand Down Expand Up @@ -3365,12 +3366,13 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
cb->prev_seq = 0;
cb->seq = 0;
}
if (dumpit(skb, cb))
ret = dumpit(skb, cb);
if (ret < 0)
break;
}
cb->family = idx;

return skb->len;
return skb->len ? : ret;
}

struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev,
Expand Down

0 comments on commit c63586d

Please sign in to comment.