diff options
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r-- | net/ipv4/inet_diag.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 77761ac4f7bb..9cd53addb784 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -153,7 +153,7 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
153 | rtattr_failure: | 153 | rtattr_failure: |
154 | nlmsg_failure: | 154 | nlmsg_failure: |
155 | skb_trim(skb, b - skb->data); | 155 | skb_trim(skb, b - skb->data); |
156 | return -1; | 156 | return -EMSGSIZE; |
157 | } | 157 | } |
158 | 158 | ||
159 | static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, | 159 | static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, |
@@ -209,7 +209,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, | |||
209 | return skb->len; | 209 | return skb->len; |
210 | nlmsg_failure: | 210 | nlmsg_failure: |
211 | skb_trim(skb, previous_tail - skb->data); | 211 | skb_trim(skb, previous_tail - skb->data); |
212 | return -1; | 212 | return -EMSGSIZE; |
213 | } | 213 | } |
214 | 214 | ||
215 | static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, | 215 | static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, |
@@ -274,11 +274,14 @@ static int inet_diag_get_exact(struct sk_buff *in_skb, | |||
274 | if (!rep) | 274 | if (!rep) |
275 | goto out; | 275 | goto out; |
276 | 276 | ||
277 | if (sk_diag_fill(sk, rep, req->idiag_ext, | 277 | err = sk_diag_fill(sk, rep, req->idiag_ext, |
278 | NETLINK_CB(in_skb).pid, | 278 | NETLINK_CB(in_skb).pid, |
279 | nlh->nlmsg_seq, 0, nlh) <= 0) | 279 | nlh->nlmsg_seq, 0, nlh); |
280 | BUG(); | 280 | if (err < 0) { |
281 | 281 | WARN_ON(err == -EMSGSIZE); | |
282 | kfree_skb(rep); | ||
283 | goto out; | ||
284 | } | ||
282 | err = netlink_unicast(idiagnl, rep, NETLINK_CB(in_skb).pid, | 285 | err = netlink_unicast(idiagnl, rep, NETLINK_CB(in_skb).pid, |
283 | MSG_DONTWAIT); | 286 | MSG_DONTWAIT); |
284 | if (err > 0) | 287 | if (err > 0) |