aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKen-ichirou MATSUZAWA <chamaken@gmail.com>2016-01-28 20:45:50 -0500
committerDavid S. Miller <davem@davemloft.net>2016-01-29 23:25:17 -0500
commitaa3a022094fac7f6e48050e139fa8a5a2e3265ce (patch)
tree71b2557ea8cbafc6f6080614b43f86a15df54b9c /net
parent7256eac13b0e6884355cf40f75db05785d18f5da (diff)
netlink: not trim skb for mmaped socket when dump
We should not trim skb for mmaped socket since its buf size is fixed and userspace will read as frame which data equals head. mmaped socket will not call recvmsg, means max_recvmsg_len is 0, skb_reserve was not called before commit: db65a3aaf29e. Fixes: db65a3aaf29e (netlink: Trim skb to alloc size to avoid MSG_TRUNC) Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/af_netlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 81dc1bb6e016..f1ffb34e253f 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2831,7 +2831,8 @@ static int netlink_dump(struct sock *sk)
2831 * reasonable static buffer based on the expected largest dump of a 2831 * reasonable static buffer based on the expected largest dump of a
2832 * single netdev. The outcome is MSG_TRUNC error. 2832 * single netdev. The outcome is MSG_TRUNC error.
2833 */ 2833 */
2834 skb_reserve(skb, skb_tailroom(skb) - alloc_size); 2834 if (!netlink_rx_is_mmaped(sk))
2835 skb_reserve(skb, skb_tailroom(skb) - alloc_size);
2835 netlink_skb_set_owner_r(skb, sk); 2836 netlink_skb_set_owner_r(skb, sk);
2836 2837
2837 len = cb->dump(skb, cb); 2838 len = cb->dump(skb, cb);