Skip to content

Commit daa3766

Browse files
committed
Revert "netlink: netlink_recvmsg() fix"
This reverts commit 1235f50. 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>
1 parent f3d3f61 commit daa3766

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

net/netlink/af_netlink.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
14061406
struct netlink_sock *nlk = nlk_sk(sk);
14071407
int noblock = flags&MSG_DONTWAIT;
14081408
size_t copied;
1409-
struct sk_buff *skb;
1409+
struct sk_buff *skb, *frag __maybe_unused = NULL;
14101410
int err;
14111411

14121412
if (flags&MSG_OOB)
@@ -1441,21 +1441,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
14411441
kfree_skb(skb);
14421442
skb = compskb;
14431443
} else {
1444-
/*
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);
1444+
frag = skb_shinfo(skb)->frag_list;
14591445
skb_shinfo(skb)->frag_list = NULL;
14601446
}
14611447
}
@@ -1492,6 +1478,10 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
14921478
if (flags & MSG_TRUNC)
14931479
copied = skb->len;
14941480

1481+
#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
1482+
skb_shinfo(skb)->frag_list = frag;
1483+
#endif
1484+
14951485
skb_free_datagram(sk, skb);
14961486

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

0 commit comments

Comments
 (0)