Commit 960a2628 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: better drop monitoring in ip{6}_recv_error()

We should call consume_skb(skb) when skb is properly consumed,
or kfree_skb(skb) when skb must be dropped in error case.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0aea76d3
...@@ -510,9 +510,10 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) ...@@ -510,9 +510,10 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
copied = len; copied = len;
} }
err = skb_copy_datagram_msg(skb, 0, msg, copied); err = skb_copy_datagram_msg(skb, 0, msg, copied);
if (err) if (unlikely(err)) {
goto out_free_skb; kfree_skb(skb);
return err;
}
sock_recv_timestamp(msg, sk, skb); sock_recv_timestamp(msg, sk, skb);
serr = SKB_EXT_ERR(skb); serr = SKB_EXT_ERR(skb);
...@@ -544,8 +545,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) ...@@ -544,8 +545,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
msg->msg_flags |= MSG_ERRQUEUE; msg->msg_flags |= MSG_ERRQUEUE;
err = copied; err = copied;
out_free_skb: consume_skb(skb);
kfree_skb(skb);
out: out:
return err; return err;
} }
......
...@@ -450,9 +450,10 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) ...@@ -450,9 +450,10 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
copied = len; copied = len;
} }
err = skb_copy_datagram_msg(skb, 0, msg, copied); err = skb_copy_datagram_msg(skb, 0, msg, copied);
if (err) if (unlikely(err)) {
goto out_free_skb; kfree_skb(skb);
return err;
}
sock_recv_timestamp(msg, sk, skb); sock_recv_timestamp(msg, sk, skb);
serr = SKB_EXT_ERR(skb); serr = SKB_EXT_ERR(skb);
...@@ -509,8 +510,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) ...@@ -509,8 +510,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
msg->msg_flags |= MSG_ERRQUEUE; msg->msg_flags |= MSG_ERRQUEUE;
err = copied; err = copied;
out_free_skb: consume_skb(skb);
kfree_skb(skb);
out: out:
return err; return err;
} }
......
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