Commit 6647b338 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

netlink: fix netlink_diag_dump() return value

__netlink_diag_dump() returns 1 if the dump is not complete,
zero if no error occurred.

If err variable is zero, this means the dump is complete:
We should not return skb->len in this case, but 0.

This allows NLMSG_DONE to be appended to the skb.
User space does not have to call us again only to get NLMSG_DONE.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarDonald Hunter <donald.hunter@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ac14ad97
...@@ -207,7 +207,7 @@ static int netlink_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -207,7 +207,7 @@ static int netlink_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
err = __netlink_diag_dump(skb, cb, req->sdiag_protocol, s_num); err = __netlink_diag_dump(skb, cb, req->sdiag_protocol, s_num);
} }
return err < 0 ? err : skb->len; return err <= 0 ? err : skb->len;
} }
static int netlink_diag_dump_done(struct netlink_callback *cb) static int netlink_diag_dump_done(struct netlink_callback *cb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment