Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203750
b: refs/heads/master
c: 1235f50
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jul 26, 2010
1 parent b983f44 commit 6a18779
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 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: 7b5e078cf04ea5b8b7ccffaf9a3607097f5c2359
refs/heads/master: 1235f504aaba2ebeabc863fdb3ceac764a317d47
22 changes: 16 additions & 6 deletions trunk/net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
struct netlink_sock *nlk = nlk_sk(sk);
int noblock = flags&MSG_DONTWAIT;
size_t copied;
struct sk_buff *skb, *frag __maybe_unused = NULL;
struct sk_buff *skb;
int err;

if (flags&MSG_OOB)
Expand Down Expand Up @@ -1441,7 +1441,21 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
kfree_skb(skb);
skb = compskb;
} else {
frag = skb_shinfo(skb)->frag_list;
/*
* Before setting frag_list to NULL, we must get a
* private copy of skb if shared (because of MSG_PEEK)
*/
if (skb_shared(skb)) {
struct sk_buff *nskb;

nskb = pskb_copy(skb, GFP_KERNEL);
kfree_skb(skb);
skb = nskb;
err = -ENOMEM;
if (!skb)
goto out;
}
kfree_skb(skb_shinfo(skb)->frag_list);
skb_shinfo(skb)->frag_list = NULL;
}
}
Expand Down Expand Up @@ -1478,10 +1492,6 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
if (flags & MSG_TRUNC)
copied = skb->len;

#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
skb_shinfo(skb)->frag_list = frag;
#endif

skb_free_datagram(sk, skb);

if (nlk->cb && atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2)
Expand Down

0 comments on commit 6a18779

Please sign in to comment.