forked from mirrors/linux
		
	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:db65a3aaf2. Fixes:db65a3aaf2(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>
This commit is contained in:
		
							parent
							
								
									7256eac13b
								
							
						
					
					
						commit
						aa3a022094
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -2831,6 +2831,7 @@ 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.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
 | 
						if (!netlink_rx_is_mmaped(sk))
 | 
				
			||||||
		skb_reserve(skb, skb_tailroom(skb) - alloc_size);
 | 
							skb_reserve(skb, skb_tailroom(skb) - alloc_size);
 | 
				
			||||||
	netlink_skb_set_owner_r(skb, sk);
 | 
						netlink_skb_set_owner_r(skb, sk);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue