aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-01-18 23:36:08 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-18 23:36:08 -0500
commit7b46a644a407f9f2f1c8f7b2af157c79af55b49e (patch)
tree5db384821399a6e07abd70a61cc0afd454144e27 /net/core
parent27c00132852b77b12e625cd6a0ccf43d6bf5795f (diff)
netlink: Fix bugs in nlmsg_end() conversions.
Commit 053c095a82cf ("netlink: make nlmsg_end() and genlmsg_end() void") didn't catch all of the cases where callers were breaking out on the return value being equal to zero, which they no longer should when zero means success. Fix all such cases. Reported-by: Marcel Holtmann <marcel@holtmann.org> Reported-by: Scott Feldman <sfeldma@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/neighbour.c8
-rw-r--r--net/core/rtnetlink.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index d36d564f149f..70fe9e10ac86 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2128,7 +2128,7 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
2128 2128
2129 if (neightbl_fill_info(skb, tbl, NETLINK_CB(cb->skb).portid, 2129 if (neightbl_fill_info(skb, tbl, NETLINK_CB(cb->skb).portid,
2130 cb->nlh->nlmsg_seq, RTM_NEWNEIGHTBL, 2130 cb->nlh->nlmsg_seq, RTM_NEWNEIGHTBL,
2131 NLM_F_MULTI) <= 0) 2131 NLM_F_MULTI) < 0)
2132 break; 2132 break;
2133 2133
2134 nidx = 0; 2134 nidx = 0;
@@ -2144,7 +2144,7 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
2144 NETLINK_CB(cb->skb).portid, 2144 NETLINK_CB(cb->skb).portid,
2145 cb->nlh->nlmsg_seq, 2145 cb->nlh->nlmsg_seq,
2146 RTM_NEWNEIGHTBL, 2146 RTM_NEWNEIGHTBL,
2147 NLM_F_MULTI) <= 0) 2147 NLM_F_MULTI) < 0)
2148 goto out; 2148 goto out;
2149 next: 2149 next:
2150 nidx++; 2150 nidx++;
@@ -2274,7 +2274,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
2274 if (neigh_fill_info(skb, n, NETLINK_CB(cb->skb).portid, 2274 if (neigh_fill_info(skb, n, NETLINK_CB(cb->skb).portid,
2275 cb->nlh->nlmsg_seq, 2275 cb->nlh->nlmsg_seq,
2276 RTM_NEWNEIGH, 2276 RTM_NEWNEIGH,
2277 NLM_F_MULTI) <= 0) { 2277 NLM_F_MULTI) < 0) {
2278 rc = -1; 2278 rc = -1;
2279 goto out; 2279 goto out;
2280 } 2280 }
@@ -2311,7 +2311,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
2311 if (pneigh_fill_info(skb, n, NETLINK_CB(cb->skb).portid, 2311 if (pneigh_fill_info(skb, n, NETLINK_CB(cb->skb).portid,
2312 cb->nlh->nlmsg_seq, 2312 cb->nlh->nlmsg_seq,
2313 RTM_NEWNEIGH, 2313 RTM_NEWNEIGH,
2314 NLM_F_MULTI, tbl) <= 0) { 2314 NLM_F_MULTI, tbl) < 0) {
2315 read_unlock_bh(&tbl->lock); 2315 read_unlock_bh(&tbl->lock);
2316 rc = -1; 2316 rc = -1;
2317 goto out; 2317 goto out;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e13b9dbdf154..0e26b9f66cad 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1327,7 +1327,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1327 */ 1327 */
1328 WARN_ON((err == -EMSGSIZE) && (skb->len == 0)); 1328 WARN_ON((err == -EMSGSIZE) && (skb->len == 0));
1329 1329
1330 if (err <= 0) 1330 if (err < 0)
1331 goto out; 1331 goto out;
1332 1332
1333 nl_dump_check_consistent(cb, nlmsg_hdr(skb)); 1333 nl_dump_check_consistent(cb, nlmsg_hdr(skb));