All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] netlink: not trim skb for mmaped socket when dump
@ 2016-01-29  1:45 Ken-ichirou MATSUZAWA
  2016-01-30  4:25 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ken-ichirou MATSUZAWA @ 2016-01-29  1:45 UTC (permalink / raw)
  To: netdev

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>

---
 net/netlink/af_netlink.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 81dc1bb..f1ffb34 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2831,7 +2831,8 @@ static int netlink_dump(struct sock *sk)
 	 * reasonable static buffer based on the expected largest dump of a
 	 * 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);
 
 	len = cb->dump(skb, cb);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] netlink: not trim skb for mmaped socket when dump
  2016-01-29  1:45 [PATCH net] netlink: not trim skb for mmaped socket when dump Ken-ichirou MATSUZAWA
@ 2016-01-30  4:25 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-01-30  4:25 UTC (permalink / raw)
  To: chamaken; +Cc: netdev

From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
Date: Fri, 29 Jan 2016 10:45:50 +0900

> 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>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-30  4:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-29  1:45 [PATCH net] netlink: not trim skb for mmaped socket when dump Ken-ichirou MATSUZAWA
2016-01-30  4:25 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.