Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78338
b: refs/heads/master
c: 27ab256
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jan 28, 2008
1 parent 0142ee9 commit 59f0551
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c8fecf2242a0ab7230210665986b8ef915e1ae9e
refs/heads/master: 27ab2568649d5ba6c5a20212079b7c4f6da4ca0d
2 changes: 1 addition & 1 deletion trunk/include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
int hlen,
struct iovec *iov);
extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
unsigned int flags);
extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
int len, __wsum csum);
Expand Down
9 changes: 8 additions & 1 deletion trunk/net/core/datagram.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,27 @@ void skb_free_datagram(struct sock *sk, struct sk_buff *skb)
* This function currently only disables BH when acquiring the
* sk_receive_queue lock. Therefore it must not be used in a
* context where that lock is acquired in an IRQ context.
*
* It returns 0 if the packet was removed by us.
*/

void skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags)
int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags)
{
int err = 0;

if (flags & MSG_PEEK) {
err = -ENOENT;
spin_lock_bh(&sk->sk_receive_queue.lock);
if (skb == skb_peek(&sk->sk_receive_queue)) {
__skb_unlink(skb, &sk->sk_receive_queue);
atomic_dec(&skb->users);
err = 0;
}
spin_unlock_bh(&sk->sk_receive_queue.lock);
}

kfree_skb(skb);
return err;
}

EXPORT_SYMBOL(skb_kill_datagram);
Expand Down
5 changes: 2 additions & 3 deletions trunk/net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,8 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
return err;

csum_copy_err:
UDP_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);

skb_kill_datagram(sk, skb, flags);
if (!skb_kill_datagram(sk, skb, flags))
UDP_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);

if (noblock)
return -EAGAIN;
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
return err;

csum_copy_err:
UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
skb_kill_datagram(sk, skb, flags);
if (!skb_kill_datagram(sk, skb, flags))
UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);

if (flags & MSG_DONTWAIT)
return -EAGAIN;
Expand Down

0 comments on commit 59f0551

Please sign in to comment.