diff options
author | David S. Miller <davem@davemloft.net> | 2010-08-16 02:21:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-16 02:21:50 -0400 |
commit | daa3766e705c2605bd7f63b80c7742014ef9e04e (patch) | |
tree | 8fac0e0747172f9ed43aa9929a858f3b993df46a /net/netlink/af_netlink.c | |
parent | f3d3f616e35db2ceeb11564eafd50759bb5bca8a (diff) |
Revert "netlink: netlink_recvmsg() fix"
This reverts commit 1235f504aaba2ebeabc863fdb3ceac764a317d47.
It causes regressions worse than the problem it was trying
to fix. Eric will try to solve the problem another way.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink/af_netlink.c')
-rw-r--r-- | net/netlink/af_netlink.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 2cbf380377d5..8648a9922aab 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1406,7 +1406,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock, | |||
1406 | struct netlink_sock *nlk = nlk_sk(sk); | 1406 | struct netlink_sock *nlk = nlk_sk(sk); |
1407 | int noblock = flags&MSG_DONTWAIT; | 1407 | int noblock = flags&MSG_DONTWAIT; |
1408 | size_t copied; | 1408 | size_t copied; |
1409 | struct sk_buff *skb; | 1409 | struct sk_buff *skb, *frag __maybe_unused = NULL; |
1410 | int err; | 1410 | int err; |
1411 | 1411 | ||
1412 | if (flags&MSG_OOB) | 1412 | if (flags&MSG_OOB) |
@@ -1441,21 +1441,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock, | |||
1441 | kfree_skb(skb); | 1441 | kfree_skb(skb); |
1442 | skb = compskb; | 1442 | skb = compskb; |
1443 | } else { | 1443 | } else { |
1444 | /* | 1444 | frag = skb_shinfo(skb)->frag_list; |
1445 | * Before setting frag_list to NULL, we must get a | ||
1446 | * private copy of skb if shared (because of MSG_PEEK) | ||
1447 | */ | ||
1448 | if (skb_shared(skb)) { | ||
1449 | struct sk_buff *nskb; | ||
1450 | |||
1451 | nskb = pskb_copy(skb, GFP_KERNEL); | ||
1452 | kfree_skb(skb); | ||
1453 | skb = nskb; | ||
1454 | err = -ENOMEM; | ||
1455 | if (!skb) | ||
1456 | goto out; | ||
1457 | } | ||
1458 | kfree_skb(skb_shinfo(skb)->frag_list); | ||
1459 | skb_shinfo(skb)->frag_list = NULL; | 1445 | skb_shinfo(skb)->frag_list = NULL; |
1460 | } | 1446 | } |
1461 | } | 1447 | } |
@@ -1492,6 +1478,10 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock, | |||
1492 | if (flags & MSG_TRUNC) | 1478 | if (flags & MSG_TRUNC) |
1493 | copied = skb->len; | 1479 | copied = skb->len; |
1494 | 1480 | ||
1481 | #ifdef CONFIG_COMPAT_NETLINK_MESSAGES | ||
1482 | skb_shinfo(skb)->frag_list = frag; | ||
1483 | #endif | ||
1484 | |||
1495 | skb_free_datagram(sk, skb); | 1485 | skb_free_datagram(sk, skb); |
1496 | 1486 | ||
1497 | if (nlk->cb && atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) | 1487 | if (nlk->cb && atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) |