diff options
51 files changed, 203 insertions, 158 deletions
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index ef2d730734dc..e24ea4e796e4 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c | |||
@@ -100,7 +100,6 @@ int acpi_bus_generate_netlink_event(const char *device_class, | |||
100 | struct acpi_genl_event *event; | 100 | struct acpi_genl_event *event; |
101 | void *msg_header; | 101 | void *msg_header; |
102 | int size; | 102 | int size; |
103 | int result; | ||
104 | 103 | ||
105 | /* allocate memory */ | 104 | /* allocate memory */ |
106 | size = nla_total_size(sizeof(struct acpi_genl_event)) + | 105 | size = nla_total_size(sizeof(struct acpi_genl_event)) + |
@@ -137,11 +136,7 @@ int acpi_bus_generate_netlink_event(const char *device_class, | |||
137 | event->data = data; | 136 | event->data = data; |
138 | 137 | ||
139 | /* send multicast genetlink message */ | 138 | /* send multicast genetlink message */ |
140 | result = genlmsg_end(skb, msg_header); | 139 | genlmsg_end(skb, msg_header); |
141 | if (result < 0) { | ||
142 | nlmsg_free(skb); | ||
143 | return result; | ||
144 | } | ||
145 | 140 | ||
146 | genlmsg_multicast(&acpi_event_genl_family, skb, 0, 0, GFP_ATOMIC); | 141 | genlmsg_multicast(&acpi_event_genl_family, skb, 0, 0, GFP_ATOMIC); |
147 | return 0; | 142 | return 0; |
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c index 964d719b150f..d54781e71cd4 100644 --- a/drivers/net/ethernet/rocker/rocker.c +++ b/drivers/net/ethernet/rocker/rocker.c | |||
@@ -3674,7 +3674,8 @@ static int rocker_fdb_fill_info(struct sk_buff *skb, | |||
3674 | if (vid && nla_put_u16(skb, NDA_VLAN, vid)) | 3674 | if (vid && nla_put_u16(skb, NDA_VLAN, vid)) |
3675 | goto nla_put_failure; | 3675 | goto nla_put_failure; |
3676 | 3676 | ||
3677 | return nlmsg_end(skb, nlh); | 3677 | nlmsg_end(skb, nlh); |
3678 | return 0; | ||
3678 | 3679 | ||
3679 | nla_put_failure: | 3680 | nla_put_failure: |
3680 | nlmsg_cancel(skb, nlh); | 3681 | nlmsg_cancel(skb, nlh); |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 6b6b45622a0a..c5f79e7513a6 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -363,7 +363,8 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan, | |||
363 | if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci)) | 363 | if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci)) |
364 | goto nla_put_failure; | 364 | goto nla_put_failure; |
365 | 365 | ||
366 | return nlmsg_end(skb, nlh); | 366 | nlmsg_end(skb, nlh); |
367 | return 0; | ||
367 | 368 | ||
368 | nla_put_failure: | 369 | nla_put_failure: |
369 | nlmsg_cancel(skb, nlh); | 370 | nlmsg_cancel(skb, nlh); |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 494e7335aa64..4a4c6586a8d2 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -2557,7 +2557,8 @@ static int mac80211_hwsim_get_radio(struct sk_buff *skb, | |||
2557 | if (res < 0) | 2557 | if (res < 0) |
2558 | goto out_err; | 2558 | goto out_err; |
2559 | 2559 | ||
2560 | return genlmsg_end(skb, hdr); | 2560 | genlmsg_end(skb, hdr); |
2561 | return 0; | ||
2561 | 2562 | ||
2562 | out_err: | 2563 | out_err: |
2563 | genlmsg_cancel(skb, hdr); | 2564 | genlmsg_cancel(skb, hdr); |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 8c27b6a77ec4..cf222f46eac5 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -1473,13 +1473,7 @@ static int pmcraid_notify_aen( | |||
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | /* send genetlink multicast message to notify appplications */ | 1475 | /* send genetlink multicast message to notify appplications */ |
1476 | result = genlmsg_end(skb, msg_header); | 1476 | genlmsg_end(skb, msg_header); |
1477 | |||
1478 | if (result < 0) { | ||
1479 | pmcraid_err("genlmsg_end failed\n"); | ||
1480 | nlmsg_free(skb); | ||
1481 | return result; | ||
1482 | } | ||
1483 | 1477 | ||
1484 | result = genlmsg_multicast(&pmcraid_event_family, skb, | 1478 | result = genlmsg_multicast(&pmcraid_event_family, skb, |
1485 | 0, 0, GFP_ATOMIC); | 1479 | 0, 0, GFP_ATOMIC); |
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 1157b559683b..1a1bcf71ec9d 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
@@ -784,9 +784,7 @@ static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int mino | |||
784 | if (ret < 0) | 784 | if (ret < 0) |
785 | goto free_skb; | 785 | goto free_skb; |
786 | 786 | ||
787 | ret = genlmsg_end(skb, msg_header); | 787 | genlmsg_end(skb, msg_header); |
788 | if (ret < 0) | ||
789 | goto free_skb; | ||
790 | 788 | ||
791 | ret = genlmsg_multicast(&tcmu_genl_family, skb, 0, | 789 | ret = genlmsg_multicast(&tcmu_genl_family, skb, 0, |
792 | TCMU_MCGRP_CONFIG, GFP_KERNEL); | 790 | TCMU_MCGRP_CONFIG, GFP_KERNEL); |
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 87e0b0782023..48491d1a81d6 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -1759,11 +1759,7 @@ int thermal_generate_netlink_event(struct thermal_zone_device *tz, | |||
1759 | thermal_event->event = event; | 1759 | thermal_event->event = event; |
1760 | 1760 | ||
1761 | /* send multicast genetlink message */ | 1761 | /* send multicast genetlink message */ |
1762 | result = genlmsg_end(skb, msg_header); | 1762 | genlmsg_end(skb, msg_header); |
1763 | if (result < 0) { | ||
1764 | nlmsg_free(skb); | ||
1765 | return result; | ||
1766 | } | ||
1767 | 1763 | ||
1768 | result = genlmsg_multicast(&thermal_event_genl_family, skb, 0, | 1764 | result = genlmsg_multicast(&thermal_event_genl_family, skb, 0, |
1769 | 0, GFP_ATOMIC); | 1765 | 0, GFP_ATOMIC); |
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c index e7cfbaf8d0e2..1e6e227134d7 100644 --- a/fs/dlm/netlink.c +++ b/fs/dlm/netlink.c | |||
@@ -56,13 +56,8 @@ static int send_data(struct sk_buff *skb) | |||
56 | { | 56 | { |
57 | struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); | 57 | struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); |
58 | void *data = genlmsg_data(genlhdr); | 58 | void *data = genlmsg_data(genlhdr); |
59 | int rv; | ||
60 | 59 | ||
61 | rv = genlmsg_end(skb, data); | 60 | genlmsg_end(skb, data); |
62 | if (rv < 0) { | ||
63 | nlmsg_free(skb); | ||
64 | return rv; | ||
65 | } | ||
66 | 61 | ||
67 | return genlmsg_unicast(&init_net, skb, listener_nlportid); | 62 | return genlmsg_unicast(&init_net, skb, listener_nlportid); |
68 | } | 63 | } |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 84125088c309..f24aa83b80b6 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -245,9 +245,9 @@ static inline void *genlmsg_put_reply(struct sk_buff *skb, | |||
245 | * @skb: socket buffer the message is stored in | 245 | * @skb: socket buffer the message is stored in |
246 | * @hdr: user specific header | 246 | * @hdr: user specific header |
247 | */ | 247 | */ |
248 | static inline int genlmsg_end(struct sk_buff *skb, void *hdr) | 248 | static inline void genlmsg_end(struct sk_buff *skb, void *hdr) |
249 | { | 249 | { |
250 | return nlmsg_end(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN); | 250 | nlmsg_end(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN); |
251 | } | 251 | } |
252 | 252 | ||
253 | /** | 253 | /** |
diff --git a/include/net/netlink.h b/include/net/netlink.h index d5869b90bfbb..e010ee8da41d 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -490,14 +490,10 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags) | |||
490 | * Corrects the netlink message header to include the appeneded | 490 | * Corrects the netlink message header to include the appeneded |
491 | * attributes. Only necessary if attributes have been added to | 491 | * attributes. Only necessary if attributes have been added to |
492 | * the message. | 492 | * the message. |
493 | * | ||
494 | * Returns the total data length of the skb. | ||
495 | */ | 493 | */ |
496 | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | 494 | static inline void nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) |
497 | { | 495 | { |
498 | nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh; | 496 | nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh; |
499 | |||
500 | return skb->len; | ||
501 | } | 497 | } |
502 | 498 | ||
503 | /** | 499 | /** |
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 670fff88a961..21f82c29c914 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -111,13 +111,8 @@ static int send_reply(struct sk_buff *skb, struct genl_info *info) | |||
111 | { | 111 | { |
112 | struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb)); | 112 | struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb)); |
113 | void *reply = genlmsg_data(genlhdr); | 113 | void *reply = genlmsg_data(genlhdr); |
114 | int rc; | ||
115 | 114 | ||
116 | rc = genlmsg_end(skb, reply); | 115 | genlmsg_end(skb, reply); |
117 | if (rc < 0) { | ||
118 | nlmsg_free(skb); | ||
119 | return rc; | ||
120 | } | ||
121 | 116 | ||
122 | return genlmsg_reply(skb, info); | 117 | return genlmsg_reply(skb, info); |
123 | } | 118 | } |
@@ -134,11 +129,7 @@ static void send_cpu_listeners(struct sk_buff *skb, | |||
134 | void *reply = genlmsg_data(genlhdr); | 129 | void *reply = genlmsg_data(genlhdr); |
135 | int rc, delcount = 0; | 130 | int rc, delcount = 0; |
136 | 131 | ||
137 | rc = genlmsg_end(skb, reply); | 132 | genlmsg_end(skb, reply); |
138 | if (rc < 0) { | ||
139 | nlmsg_free(skb); | ||
140 | return; | ||
141 | } | ||
142 | 133 | ||
143 | rc = 0; | 134 | rc = 0; |
144 | down_read(&listeners->sem); | 135 | down_read(&listeners->sem); |
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 03667e65cc29..08bf04bdac58 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -633,7 +633,8 @@ static int fdb_fill_info(struct sk_buff *skb, const struct net_bridge *br, | |||
633 | if (fdb->vlan_id && nla_put(skb, NDA_VLAN, sizeof(u16), &fdb->vlan_id)) | 633 | if (fdb->vlan_id && nla_put(skb, NDA_VLAN, sizeof(u16), &fdb->vlan_id)) |
634 | goto nla_put_failure; | 634 | goto nla_put_failure; |
635 | 635 | ||
636 | return nlmsg_end(skb, nlh); | 636 | nlmsg_end(skb, nlh); |
637 | return 0; | ||
637 | 638 | ||
638 | nla_put_failure: | 639 | nla_put_failure: |
639 | nlmsg_cancel(skb, nlh); | 640 | nlmsg_cancel(skb, nlh); |
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index fed61c971b17..409608960899 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c | |||
@@ -190,7 +190,8 @@ static int nlmsg_populate_mdb_fill(struct sk_buff *skb, | |||
190 | 190 | ||
191 | nla_nest_end(skb, nest2); | 191 | nla_nest_end(skb, nest2); |
192 | nla_nest_end(skb, nest); | 192 | nla_nest_end(skb, nest); |
193 | return nlmsg_end(skb, nlh); | 193 | nlmsg_end(skb, nlh); |
194 | return 0; | ||
194 | 195 | ||
195 | end: | 196 | end: |
196 | nla_nest_end(skb, nest); | 197 | nla_nest_end(skb, nest); |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 163950b10d8c..528cf2790a5f 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -263,7 +263,8 @@ static int br_fill_ifinfo(struct sk_buff *skb, | |||
263 | } | 263 | } |
264 | 264 | ||
265 | done: | 265 | done: |
266 | return nlmsg_end(skb, nlh); | 266 | nlmsg_end(skb, nlh); |
267 | return 0; | ||
267 | 268 | ||
268 | nla_put_failure: | 269 | nla_put_failure: |
269 | nlmsg_cancel(skb, nlh); | 270 | nlmsg_cancel(skb, nlh); |
diff --git a/net/can/gw.c b/net/can/gw.c index 295f62e62eb3..a6f448e18ea8 100644 --- a/net/can/gw.c +++ b/net/can/gw.c | |||
@@ -575,7 +575,8 @@ static int cgw_put_job(struct sk_buff *skb, struct cgw_job *gwj, int type, | |||
575 | goto cancel; | 575 | goto cancel; |
576 | } | 576 | } |
577 | 577 | ||
578 | return nlmsg_end(skb, nlh); | 578 | nlmsg_end(skb, nlh); |
579 | return 0; | ||
579 | 580 | ||
580 | cancel: | 581 | cancel: |
581 | nlmsg_cancel(skb, nlh); | 582 | nlmsg_cancel(skb, nlh); |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 185c341fafbd..44706e81b2e0 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -609,7 +609,8 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule, | |||
609 | if (ops->fill(rule, skb, frh) < 0) | 609 | if (ops->fill(rule, skb, frh) < 0) |
610 | goto nla_put_failure; | 610 | goto nla_put_failure; |
611 | 611 | ||
612 | return nlmsg_end(skb, nlh); | 612 | nlmsg_end(skb, nlh); |
613 | return 0; | ||
613 | 614 | ||
614 | nla_put_failure: | 615 | nla_put_failure: |
615 | nlmsg_cancel(skb, nlh); | 616 | nlmsg_cancel(skb, nlh); |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 8d614c93f86a..d36d564f149f 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1884,7 +1884,8 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, | |||
1884 | goto nla_put_failure; | 1884 | goto nla_put_failure; |
1885 | 1885 | ||
1886 | read_unlock_bh(&tbl->lock); | 1886 | read_unlock_bh(&tbl->lock); |
1887 | return nlmsg_end(skb, nlh); | 1887 | nlmsg_end(skb, nlh); |
1888 | return 0; | ||
1888 | 1889 | ||
1889 | nla_put_failure: | 1890 | nla_put_failure: |
1890 | read_unlock_bh(&tbl->lock); | 1891 | read_unlock_bh(&tbl->lock); |
@@ -1917,7 +1918,8 @@ static int neightbl_fill_param_info(struct sk_buff *skb, | |||
1917 | goto errout; | 1918 | goto errout; |
1918 | 1919 | ||
1919 | read_unlock_bh(&tbl->lock); | 1920 | read_unlock_bh(&tbl->lock); |
1920 | return nlmsg_end(skb, nlh); | 1921 | nlmsg_end(skb, nlh); |
1922 | return 0; | ||
1921 | errout: | 1923 | errout: |
1922 | read_unlock_bh(&tbl->lock); | 1924 | read_unlock_bh(&tbl->lock); |
1923 | nlmsg_cancel(skb, nlh); | 1925 | nlmsg_cancel(skb, nlh); |
@@ -2202,7 +2204,8 @@ static int neigh_fill_info(struct sk_buff *skb, struct neighbour *neigh, | |||
2202 | nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci)) | 2204 | nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci)) |
2203 | goto nla_put_failure; | 2205 | goto nla_put_failure; |
2204 | 2206 | ||
2205 | return nlmsg_end(skb, nlh); | 2207 | nlmsg_end(skb, nlh); |
2208 | return 0; | ||
2206 | 2209 | ||
2207 | nla_put_failure: | 2210 | nla_put_failure: |
2208 | nlmsg_cancel(skb, nlh); | 2211 | nlmsg_cancel(skb, nlh); |
@@ -2232,7 +2235,8 @@ static int pneigh_fill_info(struct sk_buff *skb, struct pneigh_entry *pn, | |||
2232 | if (nla_put(skb, NDA_DST, tbl->key_len, pn->key)) | 2235 | if (nla_put(skb, NDA_DST, tbl->key_len, pn->key)) |
2233 | goto nla_put_failure; | 2236 | goto nla_put_failure; |
2234 | 2237 | ||
2235 | return nlmsg_end(skb, nlh); | 2238 | nlmsg_end(skb, nlh); |
2239 | return 0; | ||
2236 | 2240 | ||
2237 | nla_put_failure: | 2241 | nla_put_failure: |
2238 | nlmsg_cancel(skb, nlh); | 2242 | nlmsg_cancel(skb, nlh); |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index eadc5c0e2dfa..e13b9dbdf154 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1199,7 +1199,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, | |||
1199 | 1199 | ||
1200 | nla_nest_end(skb, af_spec); | 1200 | nla_nest_end(skb, af_spec); |
1201 | 1201 | ||
1202 | return nlmsg_end(skb, nlh); | 1202 | nlmsg_end(skb, nlh); |
1203 | return 0; | ||
1203 | 1204 | ||
1204 | nla_put_failure: | 1205 | nla_put_failure: |
1205 | nlmsg_cancel(skb, nlh); | 1206 | nlmsg_cancel(skb, nlh); |
@@ -2326,7 +2327,8 @@ static int nlmsg_populate_fdb_fill(struct sk_buff *skb, | |||
2326 | if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr)) | 2327 | if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr)) |
2327 | goto nla_put_failure; | 2328 | goto nla_put_failure; |
2328 | 2329 | ||
2329 | return nlmsg_end(skb, nlh); | 2330 | nlmsg_end(skb, nlh); |
2331 | return 0; | ||
2330 | 2332 | ||
2331 | nla_put_failure: | 2333 | nla_put_failure: |
2332 | nlmsg_cancel(skb, nlh); | 2334 | nlmsg_cancel(skb, nlh); |
@@ -2809,7 +2811,8 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, | |||
2809 | 2811 | ||
2810 | nla_nest_end(skb, protinfo); | 2812 | nla_nest_end(skb, protinfo); |
2811 | 2813 | ||
2812 | return nlmsg_end(skb, nlh); | 2814 | nlmsg_end(skb, nlh); |
2815 | return 0; | ||
2813 | nla_put_failure: | 2816 | nla_put_failure: |
2814 | nlmsg_cancel(skb, nlh); | 2817 | nlmsg_cancel(skb, nlh); |
2815 | return -EMSGSIZE; | 2818 | return -EMSGSIZE; |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 4400da7739da..b2c26b081134 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -702,7 +702,8 @@ static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa, | |||
702 | nla_put_string(skb, IFA_LABEL, ifa->ifa_label)) || | 702 | nla_put_string(skb, IFA_LABEL, ifa->ifa_label)) || |
703 | nla_put_u32(skb, IFA_FLAGS, ifa_flags)) | 703 | nla_put_u32(skb, IFA_FLAGS, ifa_flags)) |
704 | goto nla_put_failure; | 704 | goto nla_put_failure; |
705 | return nlmsg_end(skb, nlh); | 705 | nlmsg_end(skb, nlh); |
706 | return 0; | ||
706 | 707 | ||
707 | nla_put_failure: | 708 | nla_put_failure: |
708 | nlmsg_cancel(skb, nlh); | 709 | nlmsg_cancel(skb, nlh); |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index daccc4a36d80..812e5e6e88fb 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1616,7 +1616,8 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 portid, u32 seq, | |||
1616 | nla_put_u32(skb, RTA_IIF, rt->fld.flowidn_iif) < 0) | 1616 | nla_put_u32(skb, RTA_IIF, rt->fld.flowidn_iif) < 0) |
1617 | goto errout; | 1617 | goto errout; |
1618 | 1618 | ||
1619 | return nlmsg_end(skb, nlh); | 1619 | nlmsg_end(skb, nlh); |
1620 | return 0; | ||
1620 | 1621 | ||
1621 | errout: | 1622 | errout: |
1622 | nlmsg_cancel(skb, nlh); | 1623 | nlmsg_cancel(skb, nlh); |
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index 3f19fcbf126d..1540b506e3e0 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -367,7 +367,8 @@ static int dn_fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
367 | nla_nest_end(skb, mp_head); | 367 | nla_nest_end(skb, mp_head); |
368 | } | 368 | } |
369 | 369 | ||
370 | return nlmsg_end(skb, nlh); | 370 | nlmsg_end(skb, nlh); |
371 | return 0; | ||
371 | 372 | ||
372 | errout: | 373 | errout: |
373 | nlmsg_cancel(skb, nlh); | 374 | nlmsg_cancel(skb, nlh); |
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c index fa1464762d0d..c8133c07ceee 100644 --- a/net/ieee802154/netlink.c +++ b/net/ieee802154/netlink.c | |||
@@ -63,13 +63,9 @@ int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group) | |||
63 | struct nlmsghdr *nlh = nlmsg_hdr(msg); | 63 | struct nlmsghdr *nlh = nlmsg_hdr(msg); |
64 | void *hdr = genlmsg_data(nlmsg_data(nlh)); | 64 | void *hdr = genlmsg_data(nlmsg_data(nlh)); |
65 | 65 | ||
66 | if (genlmsg_end(msg, hdr) < 0) | 66 | genlmsg_end(msg, hdr); |
67 | goto out; | ||
68 | 67 | ||
69 | return genlmsg_multicast(&nl802154_family, msg, 0, group, GFP_ATOMIC); | 68 | return genlmsg_multicast(&nl802154_family, msg, 0, group, GFP_ATOMIC); |
70 | out: | ||
71 | nlmsg_free(msg); | ||
72 | return -ENOBUFS; | ||
73 | } | 69 | } |
74 | 70 | ||
75 | struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info, | 71 | struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info, |
@@ -96,13 +92,9 @@ int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info) | |||
96 | struct nlmsghdr *nlh = nlmsg_hdr(msg); | 92 | struct nlmsghdr *nlh = nlmsg_hdr(msg); |
97 | void *hdr = genlmsg_data(nlmsg_data(nlh)); | 93 | void *hdr = genlmsg_data(nlmsg_data(nlh)); |
98 | 94 | ||
99 | if (genlmsg_end(msg, hdr) < 0) | 95 | genlmsg_end(msg, hdr); |
100 | goto out; | ||
101 | 96 | ||
102 | return genlmsg_reply(msg, info); | 97 | return genlmsg_reply(msg, info); |
103 | out: | ||
104 | nlmsg_free(msg); | ||
105 | return -ENOBUFS; | ||
106 | } | 98 | } |
107 | 99 | ||
108 | static const struct genl_ops ieee8021154_ops[] = { | 100 | static const struct genl_ops ieee8021154_ops[] = { |
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c index 3c902e9516fb..9105265920fe 100644 --- a/net/ieee802154/nl-mac.c +++ b/net/ieee802154/nl-mac.c | |||
@@ -136,7 +136,8 @@ static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 portid, | |||
136 | } | 136 | } |
137 | 137 | ||
138 | wpan_phy_put(phy); | 138 | wpan_phy_put(phy); |
139 | return genlmsg_end(msg, hdr); | 139 | genlmsg_end(msg, hdr); |
140 | return 0; | ||
140 | 141 | ||
141 | nla_put_failure: | 142 | nla_put_failure: |
142 | wpan_phy_put(phy); | 143 | wpan_phy_put(phy); |
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c index 7baf98b14611..1b9d25f6e898 100644 --- a/net/ieee802154/nl-phy.c +++ b/net/ieee802154/nl-phy.c | |||
@@ -65,7 +65,8 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 portid, | |||
65 | goto nla_put_failure; | 65 | goto nla_put_failure; |
66 | mutex_unlock(&phy->pib_lock); | 66 | mutex_unlock(&phy->pib_lock); |
67 | kfree(buf); | 67 | kfree(buf); |
68 | return genlmsg_end(msg, hdr); | 68 | genlmsg_end(msg, hdr); |
69 | return 0; | ||
69 | 70 | ||
70 | nla_put_failure: | 71 | nla_put_failure: |
71 | mutex_unlock(&phy->pib_lock); | 72 | mutex_unlock(&phy->pib_lock); |
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index a25b9bbd077b..a4daf91b8d0a 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c | |||
@@ -306,7 +306,8 @@ static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev, | |||
306 | goto nla_put_failure; | 306 | goto nla_put_failure; |
307 | 307 | ||
308 | finish: | 308 | finish: |
309 | return genlmsg_end(msg, hdr); | 309 | genlmsg_end(msg, hdr); |
310 | return 0; | ||
310 | 311 | ||
311 | nla_put_failure: | 312 | nla_put_failure: |
312 | genlmsg_cancel(msg, hdr); | 313 | genlmsg_cancel(msg, hdr); |
@@ -489,7 +490,8 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, | |||
489 | if (nla_put_u8(msg, NL802154_ATTR_LBT_MODE, wpan_dev->lbt)) | 490 | if (nla_put_u8(msg, NL802154_ATTR_LBT_MODE, wpan_dev->lbt)) |
490 | goto nla_put_failure; | 491 | goto nla_put_failure; |
491 | 492 | ||
492 | return genlmsg_end(msg, hdr); | 493 | genlmsg_end(msg, hdr); |
494 | return 0; | ||
493 | 495 | ||
494 | nla_put_failure: | 496 | nla_put_failure: |
495 | genlmsg_cancel(msg, hdr); | 497 | genlmsg_cancel(msg, hdr); |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 214882e7d6de..5f344eb3fc25 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1522,7 +1522,8 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa, | |||
1522 | preferred, valid)) | 1522 | preferred, valid)) |
1523 | goto nla_put_failure; | 1523 | goto nla_put_failure; |
1524 | 1524 | ||
1525 | return nlmsg_end(skb, nlh); | 1525 | nlmsg_end(skb, nlh); |
1526 | return 0; | ||
1526 | 1527 | ||
1527 | nla_put_failure: | 1528 | nla_put_failure: |
1528 | nlmsg_cancel(skb, nlh); | 1529 | nlmsg_cancel(skb, nlh); |
@@ -1566,7 +1567,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | |||
1566 | if (inet_fill_ifaddr(skb, ifa, | 1567 | if (inet_fill_ifaddr(skb, ifa, |
1567 | NETLINK_CB(cb->skb).portid, | 1568 | NETLINK_CB(cb->skb).portid, |
1568 | cb->nlh->nlmsg_seq, | 1569 | cb->nlh->nlmsg_seq, |
1569 | RTM_NEWADDR, NLM_F_MULTI) <= 0) { | 1570 | RTM_NEWADDR, NLM_F_MULTI) < 0) { |
1570 | rcu_read_unlock(); | 1571 | rcu_read_unlock(); |
1571 | goto done; | 1572 | goto done; |
1572 | } | 1573 | } |
@@ -1749,7 +1750,8 @@ static int inet_netconf_fill_devconf(struct sk_buff *skb, int ifindex, | |||
1749 | IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0) | 1750 | IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0) |
1750 | goto nla_put_failure; | 1751 | goto nla_put_failure; |
1751 | 1752 | ||
1752 | return nlmsg_end(skb, nlh); | 1753 | nlmsg_end(skb, nlh); |
1754 | return 0; | ||
1753 | 1755 | ||
1754 | nla_put_failure: | 1756 | nla_put_failure: |
1755 | nlmsg_cancel(skb, nlh); | 1757 | nlmsg_cancel(skb, nlh); |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index d2b7b5521b1b..265cb72b7c1b 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1091,7 +1091,8 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1091 | nla_nest_end(skb, mp); | 1091 | nla_nest_end(skb, mp); |
1092 | } | 1092 | } |
1093 | #endif | 1093 | #endif |
1094 | return nlmsg_end(skb, nlh); | 1094 | nlmsg_end(skb, nlh); |
1095 | return 0; | ||
1095 | 1096 | ||
1096 | nla_put_failure: | 1097 | nla_put_failure: |
1097 | nlmsg_cancel(skb, nlh); | 1098 | nlmsg_cancel(skb, nlh); |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index e34dccbc4d70..81751f12645f 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -203,7 +203,8 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | |||
203 | icsk->icsk_ca_ops->get_info(sk, ext, skb); | 203 | icsk->icsk_ca_ops->get_info(sk, ext, skb); |
204 | 204 | ||
205 | out: | 205 | out: |
206 | return nlmsg_end(skb, nlh); | 206 | nlmsg_end(skb, nlh); |
207 | return 0; | ||
207 | 208 | ||
208 | errout: | 209 | errout: |
209 | nlmsg_cancel(skb, nlh); | 210 | nlmsg_cancel(skb, nlh); |
@@ -271,7 +272,8 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, | |||
271 | } | 272 | } |
272 | #endif | 273 | #endif |
273 | 274 | ||
274 | return nlmsg_end(skb, nlh); | 275 | nlmsg_end(skb, nlh); |
276 | return 0; | ||
275 | } | 277 | } |
276 | 278 | ||
277 | static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, | 279 | static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, |
@@ -758,7 +760,8 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
758 | } | 760 | } |
759 | #endif | 761 | #endif |
760 | 762 | ||
761 | return nlmsg_end(skb, nlh); | 763 | nlmsg_end(skb, nlh); |
764 | return 0; | ||
762 | } | 765 | } |
763 | 766 | ||
764 | static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | 767 | static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index c8034587859d..9d78427652d2 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -2290,7 +2290,8 @@ static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, | |||
2290 | if (err < 0 && err != -ENOENT) | 2290 | if (err < 0 && err != -ENOENT) |
2291 | goto nla_put_failure; | 2291 | goto nla_put_failure; |
2292 | 2292 | ||
2293 | return nlmsg_end(skb, nlh); | 2293 | nlmsg_end(skb, nlh); |
2294 | return 0; | ||
2294 | 2295 | ||
2295 | nla_put_failure: | 2296 | nla_put_failure: |
2296 | nlmsg_cancel(skb, nlh); | 2297 | nlmsg_cancel(skb, nlh); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index ce112d0f2698..f6e43ca5e641 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2390,7 +2390,8 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, | |||
2390 | if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0) | 2390 | if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0) |
2391 | goto nla_put_failure; | 2391 | goto nla_put_failure; |
2392 | 2392 | ||
2393 | return nlmsg_end(skb, nlh); | 2393 | nlmsg_end(skb, nlh); |
2394 | return 0; | ||
2394 | 2395 | ||
2395 | nla_put_failure: | 2396 | nla_put_failure: |
2396 | nlmsg_cancel(skb, nlh); | 2397 | nlmsg_cancel(skb, nlh); |
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index ed9c9a91851c..e5f41bd5ec1b 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
@@ -886,7 +886,8 @@ static int tcp_metrics_dump_info(struct sk_buff *skb, | |||
886 | if (tcp_metrics_fill_info(skb, tm) < 0) | 886 | if (tcp_metrics_fill_info(skb, tm) < 0) |
887 | goto nla_put_failure; | 887 | goto nla_put_failure; |
888 | 888 | ||
889 | return genlmsg_end(skb, hdr); | 889 | genlmsg_end(skb, hdr); |
890 | return 0; | ||
890 | 891 | ||
891 | nla_put_failure: | 892 | nla_put_failure: |
892 | genlmsg_cancel(skb, hdr); | 893 | genlmsg_cancel(skb, hdr); |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f7c8bbeb27b7..8975d9501d50 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -489,7 +489,8 @@ static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex, | |||
489 | nla_put_s32(skb, NETCONFA_PROXY_NEIGH, devconf->proxy_ndp) < 0) | 489 | nla_put_s32(skb, NETCONFA_PROXY_NEIGH, devconf->proxy_ndp) < 0) |
490 | goto nla_put_failure; | 490 | goto nla_put_failure; |
491 | 491 | ||
492 | return nlmsg_end(skb, nlh); | 492 | nlmsg_end(skb, nlh); |
493 | return 0; | ||
493 | 494 | ||
494 | nla_put_failure: | 495 | nla_put_failure: |
495 | nlmsg_cancel(skb, nlh); | 496 | nlmsg_cancel(skb, nlh); |
@@ -619,7 +620,7 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb, | |||
619 | cb->nlh->nlmsg_seq, | 620 | cb->nlh->nlmsg_seq, |
620 | RTM_NEWNETCONF, | 621 | RTM_NEWNETCONF, |
621 | NLM_F_MULTI, | 622 | NLM_F_MULTI, |
622 | -1) <= 0) { | 623 | -1) < 0) { |
623 | rcu_read_unlock(); | 624 | rcu_read_unlock(); |
624 | goto done; | 625 | goto done; |
625 | } | 626 | } |
@@ -635,7 +636,7 @@ cont: | |||
635 | NETLINK_CB(cb->skb).portid, | 636 | NETLINK_CB(cb->skb).portid, |
636 | cb->nlh->nlmsg_seq, | 637 | cb->nlh->nlmsg_seq, |
637 | RTM_NEWNETCONF, NLM_F_MULTI, | 638 | RTM_NEWNETCONF, NLM_F_MULTI, |
638 | -1) <= 0) | 639 | -1) < 0) |
639 | goto done; | 640 | goto done; |
640 | else | 641 | else |
641 | h++; | 642 | h++; |
@@ -646,7 +647,7 @@ cont: | |||
646 | NETLINK_CB(cb->skb).portid, | 647 | NETLINK_CB(cb->skb).portid, |
647 | cb->nlh->nlmsg_seq, | 648 | cb->nlh->nlmsg_seq, |
648 | RTM_NEWNETCONF, NLM_F_MULTI, | 649 | RTM_NEWNETCONF, NLM_F_MULTI, |
649 | -1) <= 0) | 650 | -1) < 0) |
650 | goto done; | 651 | goto done; |
651 | else | 652 | else |
652 | h++; | 653 | h++; |
@@ -4047,7 +4048,8 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, | |||
4047 | if (nla_put_u32(skb, IFA_FLAGS, ifa->flags) < 0) | 4048 | if (nla_put_u32(skb, IFA_FLAGS, ifa->flags) < 0) |
4048 | goto error; | 4049 | goto error; |
4049 | 4050 | ||
4050 | return nlmsg_end(skb, nlh); | 4051 | nlmsg_end(skb, nlh); |
4052 | return 0; | ||
4051 | 4053 | ||
4052 | error: | 4054 | error: |
4053 | nlmsg_cancel(skb, nlh); | 4055 | nlmsg_cancel(skb, nlh); |
@@ -4076,7 +4078,8 @@ static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca, | |||
4076 | return -EMSGSIZE; | 4078 | return -EMSGSIZE; |
4077 | } | 4079 | } |
4078 | 4080 | ||
4079 | return nlmsg_end(skb, nlh); | 4081 | nlmsg_end(skb, nlh); |
4082 | return 0; | ||
4080 | } | 4083 | } |
4081 | 4084 | ||
4082 | static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, | 4085 | static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, |
@@ -4101,7 +4104,8 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, | |||
4101 | return -EMSGSIZE; | 4104 | return -EMSGSIZE; |
4102 | } | 4105 | } |
4103 | 4106 | ||
4104 | return nlmsg_end(skb, nlh); | 4107 | nlmsg_end(skb, nlh); |
4108 | return 0; | ||
4105 | } | 4109 | } |
4106 | 4110 | ||
4107 | enum addr_type_t { | 4111 | enum addr_type_t { |
@@ -4134,7 +4138,7 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb, | |||
4134 | cb->nlh->nlmsg_seq, | 4138 | cb->nlh->nlmsg_seq, |
4135 | RTM_NEWADDR, | 4139 | RTM_NEWADDR, |
4136 | NLM_F_MULTI); | 4140 | NLM_F_MULTI); |
4137 | if (err <= 0) | 4141 | if (err < 0) |
4138 | break; | 4142 | break; |
4139 | nl_dump_check_consistent(cb, nlmsg_hdr(skb)); | 4143 | nl_dump_check_consistent(cb, nlmsg_hdr(skb)); |
4140 | } | 4144 | } |
@@ -4151,7 +4155,7 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb, | |||
4151 | cb->nlh->nlmsg_seq, | 4155 | cb->nlh->nlmsg_seq, |
4152 | RTM_GETMULTICAST, | 4156 | RTM_GETMULTICAST, |
4153 | NLM_F_MULTI); | 4157 | NLM_F_MULTI); |
4154 | if (err <= 0) | 4158 | if (err < 0) |
4155 | break; | 4159 | break; |
4156 | } | 4160 | } |
4157 | break; | 4161 | break; |
@@ -4166,7 +4170,7 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb, | |||
4166 | cb->nlh->nlmsg_seq, | 4170 | cb->nlh->nlmsg_seq, |
4167 | RTM_GETANYCAST, | 4171 | RTM_GETANYCAST, |
4168 | NLM_F_MULTI); | 4172 | NLM_F_MULTI); |
4169 | if (err <= 0) | 4173 | if (err < 0) |
4170 | break; | 4174 | break; |
4171 | } | 4175 | } |
4172 | break; | 4176 | break; |
@@ -4638,7 +4642,8 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, | |||
4638 | goto nla_put_failure; | 4642 | goto nla_put_failure; |
4639 | 4643 | ||
4640 | nla_nest_end(skb, protoinfo); | 4644 | nla_nest_end(skb, protoinfo); |
4641 | return nlmsg_end(skb, nlh); | 4645 | nlmsg_end(skb, nlh); |
4646 | return 0; | ||
4642 | 4647 | ||
4643 | nla_put_failure: | 4648 | nla_put_failure: |
4644 | nlmsg_cancel(skb, nlh); | 4649 | nlmsg_cancel(skb, nlh); |
@@ -4670,7 +4675,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
4670 | if (inet6_fill_ifinfo(skb, idev, | 4675 | if (inet6_fill_ifinfo(skb, idev, |
4671 | NETLINK_CB(cb->skb).portid, | 4676 | NETLINK_CB(cb->skb).portid, |
4672 | cb->nlh->nlmsg_seq, | 4677 | cb->nlh->nlmsg_seq, |
4673 | RTM_NEWLINK, NLM_F_MULTI) <= 0) | 4678 | RTM_NEWLINK, NLM_F_MULTI) < 0) |
4674 | goto out; | 4679 | goto out; |
4675 | cont: | 4680 | cont: |
4676 | idx++; | 4681 | idx++; |
@@ -4747,7 +4752,8 @@ static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev, | |||
4747 | ci.valid_time = ntohl(pinfo->valid); | 4752 | ci.valid_time = ntohl(pinfo->valid); |
4748 | if (nla_put(skb, PREFIX_CACHEINFO, sizeof(ci), &ci)) | 4753 | if (nla_put(skb, PREFIX_CACHEINFO, sizeof(ci), &ci)) |
4749 | goto nla_put_failure; | 4754 | goto nla_put_failure; |
4750 | return nlmsg_end(skb, nlh); | 4755 | nlmsg_end(skb, nlh); |
4756 | return 0; | ||
4751 | 4757 | ||
4752 | nla_put_failure: | 4758 | nla_put_failure: |
4753 | nlmsg_cancel(skb, nlh); | 4759 | nlmsg_cancel(skb, nlh); |
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c index fd0dc47f471d..e43e79d0a612 100644 --- a/net/ipv6/addrlabel.c +++ b/net/ipv6/addrlabel.c | |||
@@ -490,7 +490,8 @@ static int ip6addrlbl_fill(struct sk_buff *skb, | |||
490 | return -EMSGSIZE; | 490 | return -EMSGSIZE; |
491 | } | 491 | } |
492 | 492 | ||
493 | return nlmsg_end(skb, nlh); | 493 | nlmsg_end(skb, nlh); |
494 | return 0; | ||
494 | } | 495 | } |
495 | 496 | ||
496 | static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb) | 497 | static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb) |
@@ -510,7 +511,7 @@ static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
510 | cb->nlh->nlmsg_seq, | 511 | cb->nlh->nlmsg_seq, |
511 | RTM_NEWADDRLABEL, | 512 | RTM_NEWADDRLABEL, |
512 | NLM_F_MULTI); | 513 | NLM_F_MULTI); |
513 | if (err <= 0) | 514 | if (err < 0) |
514 | break; | 515 | break; |
515 | } | 516 | } |
516 | idx++; | 517 | idx++; |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 03c520a4ebeb..53775ee7d376 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -277,7 +277,6 @@ static int fib6_dump_node(struct fib6_walker *w) | |||
277 | w->leaf = rt; | 277 | w->leaf = rt; |
278 | return 1; | 278 | return 1; |
279 | } | 279 | } |
280 | WARN_ON(res == 0); | ||
281 | } | 280 | } |
282 | w->leaf = NULL; | 281 | w->leaf = NULL; |
283 | return 0; | 282 | return 0; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 722669754bbf..34b682617f50 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -2388,7 +2388,8 @@ static int ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb, | |||
2388 | if (err < 0 && err != -ENOENT) | 2388 | if (err < 0 && err != -ENOENT) |
2389 | goto nla_put_failure; | 2389 | goto nla_put_failure; |
2390 | 2390 | ||
2391 | return nlmsg_end(skb, nlh); | 2391 | nlmsg_end(skb, nlh); |
2392 | return 0; | ||
2392 | 2393 | ||
2393 | nla_put_failure: | 2394 | nla_put_failure: |
2394 | nlmsg_cancel(skb, nlh); | 2395 | nlmsg_cancel(skb, nlh); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 34dcbb59df75..c60f15775c53 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2725,7 +2725,8 @@ static int rt6_fill_node(struct net *net, | |||
2725 | if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, rt->dst.error) < 0) | 2725 | if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, rt->dst.error) < 0) |
2726 | goto nla_put_failure; | 2726 | goto nla_put_failure; |
2727 | 2727 | ||
2728 | return nlmsg_end(skb, nlh); | 2728 | nlmsg_end(skb, nlh); |
2729 | return 0; | ||
2729 | 2730 | ||
2730 | nla_put_failure: | 2731 | nla_put_failure: |
2731 | nlmsg_cancel(skb, nlh); | 2732 | nlmsg_cancel(skb, nlh); |
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index 6b16598f31d5..b4e923f77954 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c | |||
@@ -390,7 +390,8 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla | |||
390 | } | 390 | } |
391 | 391 | ||
392 | out: | 392 | out: |
393 | return genlmsg_end(skb, hdr); | 393 | genlmsg_end(skb, hdr); |
394 | return 0; | ||
394 | 395 | ||
395 | nla_put_failure: | 396 | nla_put_failure: |
396 | genlmsg_cancel(skb, hdr); | 397 | genlmsg_cancel(skb, hdr); |
@@ -451,7 +452,7 @@ static int l2tp_nl_cmd_tunnel_dump(struct sk_buff *skb, struct netlink_callback | |||
451 | 452 | ||
452 | if (l2tp_nl_tunnel_send(skb, NETLINK_CB(cb->skb).portid, | 453 | if (l2tp_nl_tunnel_send(skb, NETLINK_CB(cb->skb).portid, |
453 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 454 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
454 | tunnel, L2TP_CMD_TUNNEL_GET) <= 0) | 455 | tunnel, L2TP_CMD_TUNNEL_GET) < 0) |
455 | goto out; | 456 | goto out; |
456 | 457 | ||
457 | ti++; | 458 | ti++; |
@@ -752,7 +753,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl | |||
752 | goto nla_put_failure; | 753 | goto nla_put_failure; |
753 | nla_nest_end(skb, nest); | 754 | nla_nest_end(skb, nest); |
754 | 755 | ||
755 | return genlmsg_end(skb, hdr); | 756 | genlmsg_end(skb, hdr); |
757 | return 0; | ||
756 | 758 | ||
757 | nla_put_failure: | 759 | nla_put_failure: |
758 | genlmsg_cancel(skb, hdr); | 760 | genlmsg_cancel(skb, hdr); |
@@ -816,7 +818,7 @@ static int l2tp_nl_cmd_session_dump(struct sk_buff *skb, struct netlink_callback | |||
816 | 818 | ||
817 | if (l2tp_nl_session_send(skb, NETLINK_CB(cb->skb).portid, | 819 | if (l2tp_nl_session_send(skb, NETLINK_CB(cb->skb).portid, |
818 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 820 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
819 | session, L2TP_CMD_SESSION_GET) <= 0) | 821 | session, L2TP_CMD_SESSION_GET) < 0) |
820 | break; | 822 | break; |
821 | 823 | ||
822 | si++; | 824 | si++; |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index b8295a430a56..e55759056361 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -2887,7 +2887,8 @@ static int ip_vs_genl_dump_service(struct sk_buff *skb, | |||
2887 | if (ip_vs_genl_fill_service(skb, svc) < 0) | 2887 | if (ip_vs_genl_fill_service(skb, svc) < 0) |
2888 | goto nla_put_failure; | 2888 | goto nla_put_failure; |
2889 | 2889 | ||
2890 | return genlmsg_end(skb, hdr); | 2890 | genlmsg_end(skb, hdr); |
2891 | return 0; | ||
2891 | 2892 | ||
2892 | nla_put_failure: | 2893 | nla_put_failure: |
2893 | genlmsg_cancel(skb, hdr); | 2894 | genlmsg_cancel(skb, hdr); |
@@ -3079,7 +3080,8 @@ static int ip_vs_genl_dump_dest(struct sk_buff *skb, struct ip_vs_dest *dest, | |||
3079 | if (ip_vs_genl_fill_dest(skb, dest) < 0) | 3080 | if (ip_vs_genl_fill_dest(skb, dest) < 0) |
3080 | goto nla_put_failure; | 3081 | goto nla_put_failure; |
3081 | 3082 | ||
3082 | return genlmsg_end(skb, hdr); | 3083 | genlmsg_end(skb, hdr); |
3084 | return 0; | ||
3083 | 3085 | ||
3084 | nla_put_failure: | 3086 | nla_put_failure: |
3085 | genlmsg_cancel(skb, hdr); | 3087 | genlmsg_cancel(skb, hdr); |
@@ -3215,7 +3217,8 @@ static int ip_vs_genl_dump_daemon(struct sk_buff *skb, __u32 state, | |||
3215 | if (ip_vs_genl_fill_daemon(skb, state, mcast_ifn, syncid)) | 3217 | if (ip_vs_genl_fill_daemon(skb, state, mcast_ifn, syncid)) |
3216 | goto nla_put_failure; | 3218 | goto nla_put_failure; |
3217 | 3219 | ||
3218 | return genlmsg_end(skb, hdr); | 3220 | genlmsg_end(skb, hdr); |
3221 | return 0; | ||
3219 | 3222 | ||
3220 | nla_put_failure: | 3223 | nla_put_failure: |
3221 | genlmsg_cancel(skb, hdr); | 3224 | genlmsg_cancel(skb, hdr); |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 3b3ddb4fb9ee..70f697827b9b 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -427,7 +427,8 @@ static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net, | |||
427 | nla_put_be32(skb, NFTA_TABLE_USE, htonl(table->use))) | 427 | nla_put_be32(skb, NFTA_TABLE_USE, htonl(table->use))) |
428 | goto nla_put_failure; | 428 | goto nla_put_failure; |
429 | 429 | ||
430 | return nlmsg_end(skb, nlh); | 430 | nlmsg_end(skb, nlh); |
431 | return 0; | ||
431 | 432 | ||
432 | nla_put_failure: | 433 | nla_put_failure: |
433 | nlmsg_trim(skb, nlh); | 434 | nlmsg_trim(skb, nlh); |
@@ -971,7 +972,8 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net, | |||
971 | if (nla_put_be32(skb, NFTA_CHAIN_USE, htonl(chain->use))) | 972 | if (nla_put_be32(skb, NFTA_CHAIN_USE, htonl(chain->use))) |
972 | goto nla_put_failure; | 973 | goto nla_put_failure; |
973 | 974 | ||
974 | return nlmsg_end(skb, nlh); | 975 | nlmsg_end(skb, nlh); |
976 | return 0; | ||
975 | 977 | ||
976 | nla_put_failure: | 978 | nla_put_failure: |
977 | nlmsg_trim(skb, nlh); | 979 | nlmsg_trim(skb, nlh); |
@@ -1707,7 +1709,8 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net, | |||
1707 | nla_put(skb, NFTA_RULE_USERDATA, rule->ulen, nft_userdata(rule))) | 1709 | nla_put(skb, NFTA_RULE_USERDATA, rule->ulen, nft_userdata(rule))) |
1708 | goto nla_put_failure; | 1710 | goto nla_put_failure; |
1709 | 1711 | ||
1710 | return nlmsg_end(skb, nlh); | 1712 | nlmsg_end(skb, nlh); |
1713 | return 0; | ||
1711 | 1714 | ||
1712 | nla_put_failure: | 1715 | nla_put_failure: |
1713 | nlmsg_trim(skb, nlh); | 1716 | nlmsg_trim(skb, nlh); |
@@ -2361,7 +2364,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, | |||
2361 | goto nla_put_failure; | 2364 | goto nla_put_failure; |
2362 | nla_nest_end(skb, desc); | 2365 | nla_nest_end(skb, desc); |
2363 | 2366 | ||
2364 | return nlmsg_end(skb, nlh); | 2367 | nlmsg_end(skb, nlh); |
2368 | return 0; | ||
2365 | 2369 | ||
2366 | nla_put_failure: | 2370 | nla_put_failure: |
2367 | nlmsg_trim(skb, nlh); | 2371 | nlmsg_trim(skb, nlh); |
@@ -3035,7 +3039,8 @@ static int nf_tables_fill_setelem_info(struct sk_buff *skb, | |||
3035 | 3039 | ||
3036 | nla_nest_end(skb, nest); | 3040 | nla_nest_end(skb, nest); |
3037 | 3041 | ||
3038 | return nlmsg_end(skb, nlh); | 3042 | nlmsg_end(skb, nlh); |
3043 | return 0; | ||
3039 | 3044 | ||
3040 | nla_put_failure: | 3045 | nla_put_failure: |
3041 | nlmsg_trim(skb, nlh); | 3046 | nlmsg_trim(skb, nlh); |
@@ -3324,7 +3329,8 @@ static int nf_tables_fill_gen_info(struct sk_buff *skb, struct net *net, | |||
3324 | if (nla_put_be32(skb, NFTA_GEN_ID, htonl(net->nft.base_seq))) | 3329 | if (nla_put_be32(skb, NFTA_GEN_ID, htonl(net->nft.base_seq))) |
3325 | goto nla_put_failure; | 3330 | goto nla_put_failure; |
3326 | 3331 | ||
3327 | return nlmsg_end(skb, nlh); | 3332 | nlmsg_end(skb, nlh); |
3333 | return 0; | ||
3328 | 3334 | ||
3329 | nla_put_failure: | 3335 | nla_put_failure: |
3330 | nlmsg_trim(skb, nlh); | 3336 | nlmsg_trim(skb, nlh); |
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index c2f2a53a4879..179625353cac 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c | |||
@@ -641,7 +641,8 @@ static int netlbl_cipsov4_listall_cb(struct cipso_v4_doi *doi_def, void *arg) | |||
641 | if (ret_val != 0) | 641 | if (ret_val != 0) |
642 | goto listall_cb_failure; | 642 | goto listall_cb_failure; |
643 | 643 | ||
644 | return genlmsg_end(cb_arg->skb, data); | 644 | genlmsg_end(cb_arg->skb, data); |
645 | return 0; | ||
645 | 646 | ||
646 | listall_cb_failure: | 647 | listall_cb_failure: |
647 | genlmsg_cancel(cb_arg->skb, data); | 648 | genlmsg_cancel(cb_arg->skb, data); |
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index e66e977ef2fa..8b3b789c43c2 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -456,7 +456,8 @@ static int netlbl_mgmt_listall_cb(struct netlbl_dom_map *entry, void *arg) | |||
456 | goto listall_cb_failure; | 456 | goto listall_cb_failure; |
457 | 457 | ||
458 | cb_arg->seq++; | 458 | cb_arg->seq++; |
459 | return genlmsg_end(cb_arg->skb, data); | 459 | genlmsg_end(cb_arg->skb, data); |
460 | return 0; | ||
460 | 461 | ||
461 | listall_cb_failure: | 462 | listall_cb_failure: |
462 | genlmsg_cancel(cb_arg->skb, data); | 463 | genlmsg_cancel(cb_arg->skb, data); |
@@ -620,7 +621,8 @@ static int netlbl_mgmt_protocols_cb(struct sk_buff *skb, | |||
620 | if (ret_val != 0) | 621 | if (ret_val != 0) |
621 | goto protocols_cb_failure; | 622 | goto protocols_cb_failure; |
622 | 623 | ||
623 | return genlmsg_end(skb, data); | 624 | genlmsg_end(skb, data); |
625 | return 0; | ||
624 | 626 | ||
625 | protocols_cb_failure: | 627 | protocols_cb_failure: |
626 | genlmsg_cancel(skb, data); | 628 | genlmsg_cancel(skb, data); |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 78a63c18779e..aec7994f78cf 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1163,7 +1163,8 @@ static int netlbl_unlabel_staticlist_gen(u32 cmd, | |||
1163 | goto list_cb_failure; | 1163 | goto list_cb_failure; |
1164 | 1164 | ||
1165 | cb_arg->seq++; | 1165 | cb_arg->seq++; |
1166 | return genlmsg_end(cb_arg->skb, data); | 1166 | genlmsg_end(cb_arg->skb, data); |
1167 | return 0; | ||
1167 | 1168 | ||
1168 | list_cb_failure: | 1169 | list_cb_failure: |
1169 | genlmsg_cancel(cb_arg->skb, data); | 1170 | genlmsg_cancel(cb_arg->skb, data); |
diff --git a/net/netlink/diag.c b/net/netlink/diag.c index bb59a7ed0859..3ee63a3cff30 100644 --- a/net/netlink/diag.c +++ b/net/netlink/diag.c | |||
@@ -91,7 +91,8 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, | |||
91 | sk_diag_put_rings_cfg(sk, skb)) | 91 | sk_diag_put_rings_cfg(sk, skb)) |
92 | goto out_nlmsg_trim; | 92 | goto out_nlmsg_trim; |
93 | 93 | ||
94 | return nlmsg_end(skb, nlh); | 94 | nlmsg_end(skb, nlh); |
95 | return 0; | ||
95 | 96 | ||
96 | out_nlmsg_trim: | 97 | out_nlmsg_trim: |
97 | nlmsg_cancel(skb, nlh); | 98 | nlmsg_cancel(skb, nlh); |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 2e11061ef885..f52a7d5734cd 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -756,7 +756,8 @@ static int ctrl_fill_info(struct genl_family *family, u32 portid, u32 seq, | |||
756 | nla_nest_end(skb, nla_grps); | 756 | nla_nest_end(skb, nla_grps); |
757 | } | 757 | } |
758 | 758 | ||
759 | return genlmsg_end(skb, hdr); | 759 | genlmsg_end(skb, hdr); |
760 | return 0; | ||
760 | 761 | ||
761 | nla_put_failure: | 762 | nla_put_failure: |
762 | genlmsg_cancel(skb, hdr); | 763 | genlmsg_cancel(skb, hdr); |
@@ -796,7 +797,8 @@ static int ctrl_fill_mcgrp_info(struct genl_family *family, | |||
796 | nla_nest_end(skb, nest); | 797 | nla_nest_end(skb, nest); |
797 | nla_nest_end(skb, nla_grps); | 798 | nla_nest_end(skb, nla_grps); |
798 | 799 | ||
799 | return genlmsg_end(skb, hdr); | 800 | genlmsg_end(skb, hdr); |
801 | return 0; | ||
800 | 802 | ||
801 | nla_put_failure: | 803 | nla_put_failure: |
802 | genlmsg_cancel(skb, hdr); | 804 | genlmsg_cancel(skb, hdr); |
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index 44989fc8cddf..be387e6219a0 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -102,7 +102,8 @@ static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, | |||
102 | goto nla_put_failure; | 102 | goto nla_put_failure; |
103 | } | 103 | } |
104 | 104 | ||
105 | return genlmsg_end(msg, hdr); | 105 | genlmsg_end(msg, hdr); |
106 | return 0; | ||
106 | 107 | ||
107 | nla_put_failure: | 108 | nla_put_failure: |
108 | genlmsg_cancel(msg, hdr); | 109 | genlmsg_cancel(msg, hdr); |
@@ -518,7 +519,8 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, | |||
518 | nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode)) | 519 | nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode)) |
519 | goto nla_put_failure; | 520 | goto nla_put_failure; |
520 | 521 | ||
521 | return genlmsg_end(msg, hdr); | 522 | genlmsg_end(msg, hdr); |
523 | return 0; | ||
522 | 524 | ||
523 | nla_put_failure: | 525 | nla_put_failure: |
524 | genlmsg_cancel(msg, hdr); | 526 | genlmsg_cancel(msg, hdr); |
@@ -908,7 +910,8 @@ static int nfc_genl_send_params(struct sk_buff *msg, | |||
908 | nla_put_u16(msg, NFC_ATTR_LLC_PARAM_MIUX, be16_to_cpu(local->miux))) | 910 | nla_put_u16(msg, NFC_ATTR_LLC_PARAM_MIUX, be16_to_cpu(local->miux))) |
909 | goto nla_put_failure; | 911 | goto nla_put_failure; |
910 | 912 | ||
911 | return genlmsg_end(msg, hdr); | 913 | genlmsg_end(msg, hdr); |
914 | return 0; | ||
912 | 915 | ||
913 | nla_put_failure: | 916 | nla_put_failure: |
914 | 917 | ||
@@ -1247,8 +1250,7 @@ static int nfc_genl_send_se(struct sk_buff *msg, struct nfc_dev *dev, | |||
1247 | nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) | 1250 | nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) |
1248 | goto nla_put_failure; | 1251 | goto nla_put_failure; |
1249 | 1252 | ||
1250 | if (genlmsg_end(msg, hdr) < 0) | 1253 | genlmsg_end(msg, hdr); |
1251 | goto nla_put_failure; | ||
1252 | } | 1254 | } |
1253 | 1255 | ||
1254 | return 0; | 1256 | return 0; |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 8bda3cc12344..f45f1bf4422c 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -799,7 +799,8 @@ static int ovs_flow_cmd_fill_info(const struct sw_flow *flow, int dp_ifindex, | |||
799 | if (err) | 799 | if (err) |
800 | goto error; | 800 | goto error; |
801 | 801 | ||
802 | return genlmsg_end(skb, ovs_header); | 802 | genlmsg_end(skb, ovs_header); |
803 | return 0; | ||
803 | 804 | ||
804 | error: | 805 | error: |
805 | genlmsg_cancel(skb, ovs_header); | 806 | genlmsg_cancel(skb, ovs_header); |
@@ -1349,7 +1350,8 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, | |||
1349 | if (nla_put_u32(skb, OVS_DP_ATTR_USER_FEATURES, dp->user_features)) | 1350 | if (nla_put_u32(skb, OVS_DP_ATTR_USER_FEATURES, dp->user_features)) |
1350 | goto nla_put_failure; | 1351 | goto nla_put_failure; |
1351 | 1352 | ||
1352 | return genlmsg_end(skb, ovs_header); | 1353 | genlmsg_end(skb, ovs_header); |
1354 | return 0; | ||
1353 | 1355 | ||
1354 | nla_put_failure: | 1356 | nla_put_failure: |
1355 | genlmsg_cancel(skb, ovs_header); | 1357 | genlmsg_cancel(skb, ovs_header); |
@@ -1723,7 +1725,8 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, | |||
1723 | if (err == -EMSGSIZE) | 1725 | if (err == -EMSGSIZE) |
1724 | goto error; | 1726 | goto error; |
1725 | 1727 | ||
1726 | return genlmsg_end(skb, ovs_header); | 1728 | genlmsg_end(skb, ovs_header); |
1729 | return 0; | ||
1727 | 1730 | ||
1728 | nla_put_failure: | 1731 | nla_put_failure: |
1729 | err = -EMSGSIZE; | 1732 | err = -EMSGSIZE; |
diff --git a/net/packet/diag.c b/net/packet/diag.c index 92f2c7107eec..0ed68f0238bf 100644 --- a/net/packet/diag.c +++ b/net/packet/diag.c | |||
@@ -177,7 +177,8 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, | |||
177 | PACKET_DIAG_FILTER)) | 177 | PACKET_DIAG_FILTER)) |
178 | goto out_nlmsg_trim; | 178 | goto out_nlmsg_trim; |
179 | 179 | ||
180 | return nlmsg_end(skb, nlh); | 180 | nlmsg_end(skb, nlh); |
181 | return 0; | ||
181 | 182 | ||
182 | out_nlmsg_trim: | 183 | out_nlmsg_trim: |
183 | nlmsg_cancel(skb, nlh); | 184 | nlmsg_cancel(skb, nlh); |
diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c index b64151ade6b3..54d766842c2b 100644 --- a/net/phonet/pn_netlink.c +++ b/net/phonet/pn_netlink.c | |||
@@ -121,7 +121,8 @@ static int fill_addr(struct sk_buff *skb, struct net_device *dev, u8 addr, | |||
121 | ifm->ifa_index = dev->ifindex; | 121 | ifm->ifa_index = dev->ifindex; |
122 | if (nla_put_u8(skb, IFA_LOCAL, addr)) | 122 | if (nla_put_u8(skb, IFA_LOCAL, addr)) |
123 | goto nla_put_failure; | 123 | goto nla_put_failure; |
124 | return nlmsg_end(skb, nlh); | 124 | nlmsg_end(skb, nlh); |
125 | return 0; | ||
125 | 126 | ||
126 | nla_put_failure: | 127 | nla_put_failure: |
127 | nlmsg_cancel(skb, nlh); | 128 | nlmsg_cancel(skb, nlh); |
@@ -190,7 +191,8 @@ static int fill_route(struct sk_buff *skb, struct net_device *dev, u8 dst, | |||
190 | if (nla_put_u8(skb, RTA_DST, dst) || | 191 | if (nla_put_u8(skb, RTA_DST, dst) || |
191 | nla_put_u32(skb, RTA_OIF, dev->ifindex)) | 192 | nla_put_u32(skb, RTA_OIF, dev->ifindex)) |
192 | goto nla_put_failure; | 193 | goto nla_put_failure; |
193 | return nlmsg_end(skb, nlh); | 194 | nlmsg_end(skb, nlh); |
195 | return 0; | ||
194 | 196 | ||
195 | nla_put_failure: | 197 | nla_put_failure: |
196 | nlmsg_cancel(skb, nlh); | 198 | nlmsg_cancel(skb, nlh); |
@@ -282,9 +284,13 @@ static int route_dumpit(struct sk_buff *skb, struct netlink_callback *cb) | |||
282 | 284 | ||
283 | if (addr_idx++ < addr_start_idx) | 285 | if (addr_idx++ < addr_start_idx) |
284 | continue; | 286 | continue; |
285 | if (fill_route(skb, dev, addr << 2, NETLINK_CB(cb->skb).portid, | 287 | fill_route(skb, dev, addr << 2, NETLINK_CB(cb->skb).portid, |
286 | cb->nlh->nlmsg_seq, RTM_NEWROUTE)) | 288 | cb->nlh->nlmsg_seq, RTM_NEWROUTE); |
287 | goto out; | 289 | /* fill_route() used to return > 0 (or negative errors) but |
290 | * never 0 - ignore the return value and just go out to | ||
291 | * call dumpit again from outside to preserve the behavior | ||
292 | */ | ||
293 | goto out; | ||
288 | } | 294 | } |
289 | 295 | ||
290 | out: | 296 | out: |
diff --git a/net/unix/diag.c b/net/unix/diag.c index 86fa0f3b2caf..ef542fbca9fe 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c | |||
@@ -155,7 +155,8 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r | |||
155 | if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, sk->sk_shutdown)) | 155 | if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, sk->sk_shutdown)) |
156 | goto out_nlmsg_trim; | 156 | goto out_nlmsg_trim; |
157 | 157 | ||
158 | return nlmsg_end(skb, nlh); | 158 | nlmsg_end(skb, nlh); |
159 | return 0; | ||
159 | 160 | ||
160 | out_nlmsg_trim: | 161 | out_nlmsg_trim: |
161 | nlmsg_cancel(skb, nlh); | 162 | nlmsg_cancel(skb, nlh); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 380784378df8..4ed9039bd5f9 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1721,7 +1721,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, | |||
1721 | break; | 1721 | break; |
1722 | } | 1722 | } |
1723 | finish: | 1723 | finish: |
1724 | return genlmsg_end(msg, hdr); | 1724 | genlmsg_end(msg, hdr); |
1725 | return 0; | ||
1725 | 1726 | ||
1726 | nla_put_failure: | 1727 | nla_put_failure: |
1727 | genlmsg_cancel(msg, hdr); | 1728 | genlmsg_cancel(msg, hdr); |
@@ -2404,7 +2405,8 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag | |||
2404 | goto nla_put_failure; | 2405 | goto nla_put_failure; |
2405 | } | 2406 | } |
2406 | 2407 | ||
2407 | return genlmsg_end(msg, hdr); | 2408 | genlmsg_end(msg, hdr); |
2409 | return 0; | ||
2408 | 2410 | ||
2409 | nla_put_failure: | 2411 | nla_put_failure: |
2410 | genlmsg_cancel(msg, hdr); | 2412 | genlmsg_cancel(msg, hdr); |
@@ -3825,7 +3827,8 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, | |||
3825 | sinfo->assoc_req_ies)) | 3827 | sinfo->assoc_req_ies)) |
3826 | goto nla_put_failure; | 3828 | goto nla_put_failure; |
3827 | 3829 | ||
3828 | return genlmsg_end(msg, hdr); | 3830 | genlmsg_end(msg, hdr); |
3831 | return 0; | ||
3829 | 3832 | ||
3830 | nla_put_failure: | 3833 | nla_put_failure: |
3831 | genlmsg_cancel(msg, hdr); | 3834 | genlmsg_cancel(msg, hdr); |
@@ -4555,7 +4558,8 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 portid, u32 seq, | |||
4555 | 4558 | ||
4556 | nla_nest_end(msg, pinfoattr); | 4559 | nla_nest_end(msg, pinfoattr); |
4557 | 4560 | ||
4558 | return genlmsg_end(msg, hdr); | 4561 | genlmsg_end(msg, hdr); |
4562 | return 0; | ||
4559 | 4563 | ||
4560 | nla_put_failure: | 4564 | nla_put_failure: |
4561 | genlmsg_cancel(msg, hdr); | 4565 | genlmsg_cancel(msg, hdr); |
@@ -5507,7 +5511,8 @@ static int nl80211_send_regdom(struct sk_buff *msg, struct netlink_callback *cb, | |||
5507 | nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) | 5511 | nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) |
5508 | goto nla_put_failure; | 5512 | goto nla_put_failure; |
5509 | 5513 | ||
5510 | return genlmsg_end(msg, hdr); | 5514 | genlmsg_end(msg, hdr); |
5515 | return 0; | ||
5511 | 5516 | ||
5512 | nla_put_failure: | 5517 | nla_put_failure: |
5513 | genlmsg_cancel(msg, hdr); | 5518 | genlmsg_cancel(msg, hdr); |
@@ -6577,7 +6582,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, | |||
6577 | 6582 | ||
6578 | nla_nest_end(msg, bss); | 6583 | nla_nest_end(msg, bss); |
6579 | 6584 | ||
6580 | return genlmsg_end(msg, hdr); | 6585 | genlmsg_end(msg, hdr); |
6586 | return 0; | ||
6581 | 6587 | ||
6582 | fail_unlock_rcu: | 6588 | fail_unlock_rcu: |
6583 | rcu_read_unlock(); | 6589 | rcu_read_unlock(); |
@@ -6686,7 +6692,8 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq, | |||
6686 | 6692 | ||
6687 | nla_nest_end(msg, infoattr); | 6693 | nla_nest_end(msg, infoattr); |
6688 | 6694 | ||
6689 | return genlmsg_end(msg, hdr); | 6695 | genlmsg_end(msg, hdr); |
6696 | return 0; | ||
6690 | 6697 | ||
6691 | nla_put_failure: | 6698 | nla_put_failure: |
6692 | genlmsg_cancel(msg, hdr); | 6699 | genlmsg_cancel(msg, hdr); |
@@ -11025,7 +11032,8 @@ static int nl80211_send_scan_msg(struct sk_buff *msg, | |||
11025 | /* ignore errors and send incomplete event anyway */ | 11032 | /* ignore errors and send incomplete event anyway */ |
11026 | nl80211_add_scan_req(msg, rdev); | 11033 | nl80211_add_scan_req(msg, rdev); |
11027 | 11034 | ||
11028 | return genlmsg_end(msg, hdr); | 11035 | genlmsg_end(msg, hdr); |
11036 | return 0; | ||
11029 | 11037 | ||
11030 | nla_put_failure: | 11038 | nla_put_failure: |
11031 | genlmsg_cancel(msg, hdr); | 11039 | genlmsg_cancel(msg, hdr); |
@@ -11048,7 +11056,8 @@ nl80211_send_sched_scan_msg(struct sk_buff *msg, | |||
11048 | nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) | 11056 | nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) |
11049 | goto nla_put_failure; | 11057 | goto nla_put_failure; |
11050 | 11058 | ||
11051 | return genlmsg_end(msg, hdr); | 11059 | genlmsg_end(msg, hdr); |
11060 | return 0; | ||
11052 | 11061 | ||
11053 | nla_put_failure: | 11062 | nla_put_failure: |
11054 | genlmsg_cancel(msg, hdr); | 11063 | genlmsg_cancel(msg, hdr); |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 8128594ab379..7de2ed9ec46d 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1019,7 +1019,8 @@ static int build_spdinfo(struct sk_buff *skb, struct net *net, | |||
1019 | return err; | 1019 | return err; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | return nlmsg_end(skb, nlh); | 1022 | nlmsg_end(skb, nlh); |
1023 | return 0; | ||
1023 | } | 1024 | } |
1024 | 1025 | ||
1025 | static int xfrm_set_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh, | 1026 | static int xfrm_set_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh, |
@@ -1121,7 +1122,8 @@ static int build_sadinfo(struct sk_buff *skb, struct net *net, | |||
1121 | return err; | 1122 | return err; |
1122 | } | 1123 | } |
1123 | 1124 | ||
1124 | return nlmsg_end(skb, nlh); | 1125 | nlmsg_end(skb, nlh); |
1126 | return 0; | ||
1125 | } | 1127 | } |
1126 | 1128 | ||
1127 | static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh, | 1129 | static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh, |
@@ -1842,7 +1844,8 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, const struct | |||
1842 | if (err) | 1844 | if (err) |
1843 | goto out_cancel; | 1845 | goto out_cancel; |
1844 | 1846 | ||
1845 | return nlmsg_end(skb, nlh); | 1847 | nlmsg_end(skb, nlh); |
1848 | return 0; | ||
1846 | 1849 | ||
1847 | out_cancel: | 1850 | out_cancel: |
1848 | nlmsg_cancel(skb, nlh); | 1851 | nlmsg_cancel(skb, nlh); |
@@ -2282,7 +2285,8 @@ static int build_migrate(struct sk_buff *skb, const struct xfrm_migrate *m, | |||
2282 | goto out_cancel; | 2285 | goto out_cancel; |
2283 | } | 2286 | } |
2284 | 2287 | ||
2285 | return nlmsg_end(skb, nlh); | 2288 | nlmsg_end(skb, nlh); |
2289 | return 0; | ||
2286 | 2290 | ||
2287 | out_cancel: | 2291 | out_cancel: |
2288 | nlmsg_cancel(skb, nlh); | 2292 | nlmsg_cancel(skb, nlh); |
@@ -2490,7 +2494,8 @@ static int build_expire(struct sk_buff *skb, struct xfrm_state *x, const struct | |||
2490 | if (err) | 2494 | if (err) |
2491 | return err; | 2495 | return err; |
2492 | 2496 | ||
2493 | return nlmsg_end(skb, nlh); | 2497 | nlmsg_end(skb, nlh); |
2498 | return 0; | ||
2494 | } | 2499 | } |
2495 | 2500 | ||
2496 | static int xfrm_exp_state_notify(struct xfrm_state *x, const struct km_event *c) | 2501 | static int xfrm_exp_state_notify(struct xfrm_state *x, const struct km_event *c) |
@@ -2712,7 +2717,8 @@ static int build_acquire(struct sk_buff *skb, struct xfrm_state *x, | |||
2712 | return err; | 2717 | return err; |
2713 | } | 2718 | } |
2714 | 2719 | ||
2715 | return nlmsg_end(skb, nlh); | 2720 | nlmsg_end(skb, nlh); |
2721 | return 0; | ||
2716 | } | 2722 | } |
2717 | 2723 | ||
2718 | static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt, | 2724 | static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt, |
@@ -2827,7 +2833,8 @@ static int build_polexpire(struct sk_buff *skb, struct xfrm_policy *xp, | |||
2827 | } | 2833 | } |
2828 | upe->hard = !!hard; | 2834 | upe->hard = !!hard; |
2829 | 2835 | ||
2830 | return nlmsg_end(skb, nlh); | 2836 | nlmsg_end(skb, nlh); |
2837 | return 0; | ||
2831 | } | 2838 | } |
2832 | 2839 | ||
2833 | static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c) | 2840 | static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c) |
@@ -2986,7 +2993,8 @@ static int build_report(struct sk_buff *skb, u8 proto, | |||
2986 | return err; | 2993 | return err; |
2987 | } | 2994 | } |
2988 | } | 2995 | } |
2989 | return nlmsg_end(skb, nlh); | 2996 | nlmsg_end(skb, nlh); |
2997 | return 0; | ||
2990 | } | 2998 | } |
2991 | 2999 | ||
2992 | static int xfrm_send_report(struct net *net, u8 proto, | 3000 | static int xfrm_send_report(struct net *net, u8 proto, |
@@ -3031,7 +3039,8 @@ static int build_mapping(struct sk_buff *skb, struct xfrm_state *x, | |||
3031 | um->old_sport = x->encap->encap_sport; | 3039 | um->old_sport = x->encap->encap_sport; |
3032 | um->reqid = x->props.reqid; | 3040 | um->reqid = x->props.reqid; |
3033 | 3041 | ||
3034 | return nlmsg_end(skb, nlh); | 3042 | nlmsg_end(skb, nlh); |
3043 | return 0; | ||
3035 | } | 3044 | } |
3036 | 3045 | ||
3037 | static int xfrm_send_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, | 3046 | static int xfrm_send_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, |