Commit c501d329 authored by Ken-ichirou MATSUZAWA's avatar Ken-ichirou MATSUZAWA Committed by Luis Henriques

netlink: not trim skb for mmaped socket when dump

commit aa3a0220 upstream.

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: db65a3aa.

Fixes: db65a3aa (netlink: Trim skb to alloc size to avoid MSG_TRUNC)
Signed-off-by: default avatarKen-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 9e4e69cb
...@@ -2740,7 +2740,8 @@ static int netlink_dump(struct sock *sk) ...@@ -2740,7 +2740,8 @@ static int netlink_dump(struct sock *sk)
* reasonable static buffer based on the expected largest dump of a * reasonable static buffer based on the expected largest dump of a
* single netdev. The outcome is MSG_TRUNC error. * single netdev. The outcome is MSG_TRUNC error.
*/ */
skb_reserve(skb, skb_tailroom(skb) - alloc_size); if (!netlink_rx_is_mmaped(sk))
skb_reserve(skb, skb_tailroom(skb) - alloc_size);
netlink_skb_set_owner_r(skb, sk); netlink_skb_set_owner_r(skb, sk);
len = cb->dump(skb, cb); len = cb->dump(skb, cb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment