tree:
git://git.infradead.org/users/hch/misc.git sockptr
head: 6e97573fbdf946abb3ec30cabcc9aba14284aa3e
commit: 6e97573fbdf946abb3ec30cabcc9aba14284aa3e [46/46] net: pass a sockptr_t into
->setsockopt
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 6e97573fbdf946abb3ec30cabcc9aba14284aa3e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
In file included from arch/m68k/include/asm/io_mm.h:25,
from arch/m68k/include/asm/io.h:8,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:13,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:10,
from include/net/sock.h:38,
from net/phonet/pep.c:16:
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
83 | ({u8 __w, __v = (b); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
430 | rom_out_8(port, *buf++);
| ^~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
86 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro
'rom_out_be16'
448 | rom_out_be16(port, *buf++);
| ^~~~~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
90 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro
'rom_out_le16'
466 | rom_out_le16(port, *buf++);
| ^~~~~~~~~~~~
In file included from include/linux/kernel.h:11,
from net/phonet/pep.c:12:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with
null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET
&& (void *)(kaddr) < high_memory)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro
'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from arch/m68k/include/asm/irqflags.h:6,
from include/linux/irqflags.h:16,
from arch/m68k/include/asm/atomic.h:6,
from include/linux/atomic.h:7,
from include/linux/rcupdate.h:25,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from net/phonet/pep.c:13:
include/linux/dma-mapping.h: In function 'dma_map_resource':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with
null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET
&& (void *)(kaddr) < high_memory)
| ^~
include/asm-generic/bug.h:144:27: note: in definition of macro 'WARN_ON_ONCE'
144 | int __ret_warn_once = !!(condition); \
| ^~~~~~~~~
arch/m68k/include/asm/page_mm.h:170:25: note: in expansion of macro
'virt_addr_valid'
170 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
| ^~~~~~~~~~~~~~~
include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
| ^~~~~~~~~
net/phonet/pep.c: In function 'pep_setsockopt':
> net/phonet/pep.c:1039:12: error: invalid storage class for
function 'pep_getsockopt'
1039 | static int pep_getsockopt(struct sock
*sk, int level, int optname,
| ^~~~~~~~~~~~~~
> net/phonet/pep.c:1039:1: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
1039 | static int
pep_getsockopt(struct sock *sk, int level, int optname,
| ^~~~~~
> net/phonet/pep.c:1081:12: error: invalid storage class for
function 'pipe_skb_send'
1081 | static int pipe_skb_send(struct sock
*sk, struct sk_buff *skb)
| ^~~~~~~~~~~~~
> net/phonet/pep.c:1111:12: error: invalid storage class for
function 'pep_sendmsg'
1111 | static int pep_sendmsg(struct sock *sk,
struct msghdr *msg, size_t len)
| ^~~~~~~~~~~
> net/phonet/pep.c:1237:12: error: invalid storage class for
function 'pep_recvmsg'
1237 | static int pep_recvmsg(struct sock *sk,
struct msghdr *msg, size_t len,
| ^~~~~~~~~~~
> net/phonet/pep.c:1294:13: error: invalid storage class for
function 'pep_sock_unhash'
1294 | static void pep_sock_unhash(struct
sock *sk)
| ^~~~~~~~~~~~~~~
> net/phonet/pep.c:1329:16: error: initializer element is not
constant
1329 | .getsockopt = pep_getsockopt,
| ^~~~~~~~~~~~~~
net/phonet/pep.c:1329:16: note: (near initialization for
'pep_proto.getsockopt')
net/phonet/pep.c:1330:13: error: initializer element is not constant
1330 | .sendmsg = pep_sendmsg,
| ^~~~~~~~~~~
net/phonet/pep.c:1330:13: note: (near initialization for 'pep_proto.sendmsg')
net/phonet/pep.c:1331:13: error: initializer element is not constant
1331 | .recvmsg = pep_recvmsg,
| ^~~~~~~~~~~
net/phonet/pep.c:1331:13: note: (near initialization for 'pep_proto.recvmsg')
net/phonet/pep.c:1334:13: error: initializer element is not constant
1334 | .unhash = pep_sock_unhash,
| ^~~~~~~~~~~~~~~
net/phonet/pep.c:1334:13: note: (near initialization for 'pep_proto.unhash')
> net/phonet/pep.c:1347:19: error: invalid storage class for
function 'pep_register'
1347 | static int __init pep_register(void)
| ^~~~~~~~~~~~
> net/phonet/pep.c:1352:20: error: invalid storage class for
function 'pep_unregister'
1352 | static void __exit
pep_unregister(void)
| ^~~~~~~~~~~~~~
In file included from include/linux/bpf.h:20,
from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/net/netprio_cgroup.h:11,
from include/linux/netdevice.h:42,
from include/net/sock.h:46,
from net/phonet/pep.c:16:
> include/linux/module.h:131:42: error: invalid storage class for
function '__inittest'
131 | static inline initcall_t __maybe_unused
__inittest(void) \
| ^~~~~~~~~~
net/phonet/pep.c:1357:1: note: in expansion of macro 'module_init'
1357 | module_init(pep_register);
| ^~~~~~~~~~~
> net/phonet/pep.c:1357:1: warning: 'alias' attribute
ignored [-Wattributes]
In file included from include/linux/bpf.h:20,
from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/net/netprio_cgroup.h:11,
from include/linux/netdevice.h:42,
from include/net/sock.h:46,
from net/phonet/pep.c:16:
> include/linux/module.h:137:42: error: invalid storage class for
function '__exittest'
137 | static inline exitcall_t __maybe_unused
__exittest(void) \
| ^~~~~~~~~~
net/phonet/pep.c:1358:1: note: in expansion of macro 'module_exit'
1358 | module_exit(pep_unregister);
| ^~~~~~~~~~~
> include/linux/module.h:137:2: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
137 | static inline
exitcall_t __maybe_unused __exittest(void) \
| ^~~~~~
net/phonet/pep.c:1358:1: note: in expansion of macro 'module_exit'
1358 | module_exit(pep_unregister);
| ^~~~~~~~~~~
net/phonet/pep.c:1358:1: warning: 'alias' attribute ignored [-Wattributes]
In file included from include/linux/module.h:21,
from include/linux/bpf.h:20,
from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/net/netprio_cgroup.h:11,
from include/linux/netdevice.h:42,
from include/net/sock.h:46,
from net/phonet/pep.c:16:
> include/linux/moduleparam.h:24:1: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
24 | static const char
__UNIQUE_ID(name)[] \
| ^~~~~~
include/linux/module.h:162:32: note: in expansion of macro '__MODULE_INFO'
162 | #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
| ^~~~~~~~~~~~~
include/linux/module.h:232:32: note: in expansion of macro 'MODULE_INFO'
232 | #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
| ^~~~~~~~~~~
net/phonet/pep.c:1359:1: note: in expansion of macro 'MODULE_AUTHOR'
1359 | MODULE_AUTHOR("Remi Denis-Courmont, Nokia");
| ^~~~~~~~~~~~~
> net/phonet/pep.c:1362:1: error: expected declaration or statement
at end of input
1362 | MODULE_ALIAS_NET_PF_PROTO(PF_PHONET, PN_PROTO_PIPE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
net/phonet/pep.c:1228:17: warning: 'pep_read' defined but not used
[-Wunused-function]
1228 | struct sk_buff *pep_read(struct sock *sk)
| ^~~~~~~~
net/phonet/pep.c:1197:5: warning: 'pep_write' defined but not used
[-Wunused-function]
1197 | int pep_write(struct sock *sk, struct sk_buff *skb)
| ^~~~~~~~~
net/phonet/pep.c:1190:5: warning: 'pep_writeable' defined but not used
[-Wunused-function]
1190 | int pep_writeable(struct sock *sk)
| ^~~~~~~~~~~~~
net/phonet/pep.c:977:12: warning: 'pep_setsockopt' defined but not used
[-Wunused-function]
977 | static int pep_setsockopt(struct sock *sk, int level, int optname,
| ^~~~~~~~~~~~~~
--
In file included from arch/m68k/include/asm/io_mm.h:25,
from arch/m68k/include/asm/io.h:8,
from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:11,
from include/linux/skbuff.h:31,
from include/linux/mISDNif.h:413,
from drivers/isdn/mISDN/socket.c:9:
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
83 | ({u8 __w, __v = (b); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
430 | rom_out_8(port, *buf++);
| ^~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
86 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro
'rom_out_be16'
448 | rom_out_be16(port, *buf++);
| ^~~~~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
90 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro
'rom_out_le16'
466 | rom_out_le16(port, *buf++);
| ^~~~~~~~~~~~
In file included from include/linux/kernel.h:11,
from include/linux/uio.h:8,
from include/linux/socket.h:8,
from include/linux/mISDNif.h:24,
from drivers/isdn/mISDN/socket.c:9:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with
null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET
&& (void *)(kaddr) < high_memory)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro
'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/linux/uio.h:9,
from include/linux/socket.h:8,
from include/linux/mISDNif.h:24,
from drivers/isdn/mISDN/socket.c:9:
include/linux/dma-mapping.h: In function 'dma_map_resource':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with
null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET
&& (void *)(kaddr) < high_memory)
| ^~
include/asm-generic/bug.h:144:27: note: in definition of macro 'WARN_ON_ONCE'
144 | int __ret_warn_once = !!(condition); \
| ^~~~~~~~~
arch/m68k/include/asm/page_mm.h:170:25: note: in expansion of macro
'virt_addr_valid'
170 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
| ^~~~~~~~~~~~~~~
include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
| ^~~~~~~~~
In file included from include/linux/printk.h:7,
from include/linux/kernel.h:15,
from include/linux/uio.h:8,
from include/linux/socket.h:8,
from include/linux/mISDNif.h:24,
from drivers/isdn/mISDN/socket.c:9:
drivers/isdn/mISDN/socket.c: In function 'data_sock_setsockopt':
> include/linux/kern_levels.h:5:18: warning: format '%p'
expects argument of type 'void *', but argument 6 has type 'sockptr_t'
{aka 'struct <anonymous>'} [-Wformat=]
5 | #define KERN_SOH
"\001" /* ASCII Start Of Header */
| ^~~~~~
include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
15 | #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
| ^~~~~~~~
drivers/isdn/mISDN/socket.c:410:10: note: in expansion of macro 'KERN_DEBUG'
410 | printk(KERN_DEBUG "%s(%p, %d, %x, %p, %d)\n", __func__, sock,
| ^~~~~~~~~~
drivers/isdn/mISDN/socket.c:410:38: note: format string is defined here
410 | printk(KERN_DEBUG "%s(%p, %d, %x, %p, %d)\n", __func__, sock,
| ~^
| |
| void *
--
In file included from arch/m68k/include/asm/io_mm.h:25,
from arch/m68k/include/asm/io.h:8,
from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:11,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from include/linux/netdevice.h:37,
from net/mptcp/protocol.c:11:
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
83 | ({u8 __w, __v = (b); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
430 | rom_out_8(port, *buf++);
| ^~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
86 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro
'rom_out_be16'
448 | rom_out_be16(port, *buf++);
| ^~~~~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used
[-Wunused-but-set-variable]
90 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro
'rom_out_le16'
466 | rom_out_le16(port, *buf++);
| ^~~~~~~~~~~~
In file included from include/linux/kernel.h:11,
from net/mptcp/protocol.c:9:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with
null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET
&& (void *)(kaddr) < high_memory)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro
'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from net/mptcp/protocol.c:10:
include/linux/dma-mapping.h: In function 'dma_map_resource':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with
null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET
&& (void *)(kaddr) < high_memory)
| ^~
include/asm-generic/bug.h:144:27: note: in definition of macro 'WARN_ON_ONCE'
144 | int __ret_warn_once = !!(condition); \
| ^~~~~~~~~
arch/m68k/include/asm/page_mm.h:170:25: note: in expansion of macro
'virt_addr_valid'
170 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
| ^~~~~~~~~~~~~~~
include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
| ^~~~~~~~~
net/mptcp/protocol.c: In function 'mptcp_setsockopt_sol_socket':
> net/mptcp/protocol.c:1659:24: error: incompatible type for
argument 1 of 'USER_SOCKPTR'
1659 | USER_SOCKPTR(optval),
optlen);
| ^~~~~~
| |
| sockptr_t {aka struct <anonymous>}
In file included from include/linux/net.h:24,
from include/linux/skbuff.h:26,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from include/linux/netdevice.h:37,
from net/mptcp/protocol.c:11:
include/linux/sockptr.h:43:51: note: expected 'void *' but argument is of type
'sockptr_t' {aka 'struct <anonymous>'}
43 | static inline sockptr_t USER_SOCKPTR(void __user *p)
| ~~~~~~~~~~~~~^
> net/mptcp/protocol.c:1660:1: warning: control reaches end of
non-void function [-Wreturn-type]
1660 | }
| ^
..
vim +/pep_getsockopt +1039 net/phonet/pep.c
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1038
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 @1039 static int pep_getsockopt(struct sock
*sk, int level, int optname,
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1040 char __user *optval, int __user
*optlen)
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1041 {
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1042 struct pep_sock *pn = pep_sk(sk);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1043 int len, val;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1044
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1045 if (level != SOL_PNPIPE)
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1046 return -ENOPROTOOPT;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1047 if (get_user(len, optlen))
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1048 return -EFAULT;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1049
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1050 switch (optname) {
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1051 case PNPIPE_ENCAP:
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1052 val = pn->ifindex ?
PNPIPE_ENCAP_IP : PNPIPE_ENCAP_NONE;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1053 break;
8d98efa84b790b Kumar Sanghvi 2010-09-26 1054
03789f26722a15 Rémi Denis-Courmont 2010-10-08 1055 case PNPIPE_IFINDEX:
03789f26722a15 Rémi Denis-Courmont 2010-10-08 1056 val = pn->ifindex;
03789f26722a15 Rémi Denis-Courmont 2010-10-08 1057 break;
03789f26722a15 Rémi Denis-Courmont 2010-10-08 1058
acaf7df610ff3f Rémi Denis-Courmont 2011-03-08 1059 case PNPIPE_HANDLE:
acaf7df610ff3f Rémi Denis-Courmont 2011-03-08 1060 val = pn->pipe_handle;
acaf7df610ff3f Rémi Denis-Courmont 2011-03-08 1061 if (val == PN_PIPE_INVALID_HANDLE)
acaf7df610ff3f Rémi Denis-Courmont 2011-03-08 1062 return -EINVAL;
acaf7df610ff3f Rémi Denis-Courmont 2011-03-08 1063 break;
acaf7df610ff3f Rémi Denis-Courmont 2011-03-08 1064
bdb6e697b2a76c Dinesh Kumar Sharma 2011-11-18 1065 case PNPIPE_INITSTATE:
bdb6e697b2a76c Dinesh Kumar Sharma 2011-11-18 1066 val = pn->init_enable;
bdb6e697b2a76c Dinesh Kumar Sharma 2011-11-18 1067 break;
bdb6e697b2a76c Dinesh Kumar Sharma 2011-11-18 1068
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1069 default:
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1070 return -ENOPROTOOPT;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1071 }
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1072
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1073 len = min_t(unsigned int,
sizeof(int), len);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1074 if (put_user(len, optlen))
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1075 return -EFAULT;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1076 if (put_user(val, (int __user *)
optval))
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1077 return -EFAULT;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1078 return 0;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1079 }
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1080
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 @1081 static int pipe_skb_send(struct sock
*sk, struct sk_buff *skb)
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1082 {
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1083 struct pep_sock *pn = pep_sk(sk);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1084 struct pnpipehdr *ph;
e1a5964f0c32a7 Rémi Denis-Courmont 2010-09-29 1085 int err;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1086
be677730a0ccb6 Rémi Denis-Courmont 2008-12-17 1087 if (pn_flow_safe(pn->tx_fc)
&&
be677730a0ccb6 Rémi Denis-Courmont 2008-12-17 1088
!atomic_add_unless(&pn->tx_credits, -1, 0)) {
be677730a0ccb6 Rémi Denis-Courmont 2008-12-17 1089 kfree_skb(skb);
be677730a0ccb6 Rémi Denis-Courmont 2008-12-17 1090 return -ENOBUFS;
be677730a0ccb6 Rémi Denis-Courmont 2008-12-17 1091 }
be677730a0ccb6 Rémi Denis-Courmont 2008-12-17 1092
fea93ecef619b5 Rémi Denis-Courmont 2010-01-04 1093 skb_push(skb, 3 + pn->aligned);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1094 skb_reset_transport_header(skb);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1095 ph = pnp_hdr(skb);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1096 ph->utid = 0;
fea93ecef619b5 Rémi Denis-Courmont 2010-01-04 1097 if (pn->aligned) {
fea93ecef619b5 Rémi Denis-Courmont 2010-01-04 1098 ph->message_id =
PNS_PIPE_ALIGNED_DATA;
6321aa197547da Arnd Bergmann 2019-02-19 1099 ph->data0 = 0; /* padding */
fea93ecef619b5 Rémi Denis-Courmont 2010-01-04 1100 } else
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1101 ph->message_id = PNS_PIPE_DATA;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1102 ph->pipe_handle =
pn->pipe_handle;
14ba8faebcc241 Rémi Denis-Courmont 2011-02-24 1103 err = pn_skb_send(sk, skb, NULL);
e1a5964f0c32a7 Rémi Denis-Courmont 2010-09-29 1104
e1a5964f0c32a7 Rémi Denis-Courmont 2010-09-29 1105 if (err &&
pn_flow_safe(pn->tx_fc))
e1a5964f0c32a7 Rémi Denis-Courmont 2010-09-29 1106
atomic_inc(&pn->tx_credits);
e1a5964f0c32a7 Rémi Denis-Courmont 2010-09-29 1107 return err;
e1a5964f0c32a7 Rémi Denis-Courmont 2010-09-29 1108
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1109 }
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1110
1b784140474e4f Ying Xue 2015-03-02 @1111 static int pep_sendmsg(struct sock
*sk, struct msghdr *msg, size_t len)
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1112 {
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1113 struct pep_sock *pn = pep_sk(sk);
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1114 struct sk_buff *skb;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1115 long timeo;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1116 int flags = msg->msg_flags;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1117 int err, done;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1118
bcf1b70ac6eb0e Sasha Levin 2012-04-05 1119 if (len > USHRT_MAX)
bcf1b70ac6eb0e Sasha Levin 2012-04-05 1120 return -EMSGSIZE;
bcf1b70ac6eb0e Sasha Levin 2012-04-05 1121
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1122 if ((msg->msg_flags &
~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1123 MSG_CMSG_COMPAT)) ||
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1124 !(msg->msg_flags &
MSG_EOR))
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1125 return -EOPNOTSUPP;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1126
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1127 skb = sock_alloc_send_skb(sk,
MAX_PNPIPE_HEADER + len,
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1128 flags & MSG_DONTWAIT,
&err);
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1129 if (!skb)
02ac3268a58163 Rémi Denis-Courmont 2010-08-30 1130 return err;
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1131
638be344593b66 Rémi Denis-Courmont 2011-03-15 1132 skb_reserve(skb, MAX_PHONET_HEADER +
3 + pn->aligned);
6ce8e9ce5989ae Al Viro 2014-04-06 1133 err = memcpy_from_msg(skb_put(skb,
len), msg, len);
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1134 if (err < 0)
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1135 goto outfree;
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1136
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1137 lock_sock(sk);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1138 timeo = sock_sndtimeo(sk, flags
& MSG_DONTWAIT);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1139 if ((1 << sk->sk_state)
& (TCPF_LISTEN|TCPF_CLOSE)) {
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1140 err = -ENOTCONN;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1141 goto out;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1142 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1143 if (sk->sk_state !=
TCP_ESTABLISHED) {
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1144 /* Wait until the pipe gets to
enabled state */
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1145 disabled:
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1146 err = sk_stream_wait_connect(sk,
&timeo);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1147 if (err)
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1148 goto out;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1149
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1150 if (sk->sk_state ==
TCP_CLOSE_WAIT) {
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1151 err = -ECONNRESET;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1152 goto out;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1153 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1154 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1155 BUG_ON(sk->sk_state !=
TCP_ESTABLISHED);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1156
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1157 /* Wait until flow control allows TX
*/
be677730a0ccb6 Rémi Denis-Courmont 2008-12-17 1158 done =
atomic_read(&pn->tx_credits);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1159 while (!done) {
d9dc8b0f8b4ec8 WANG Cong 2016-11-11 1160 DEFINE_WAIT_FUNC(wait,
woken_wake_function);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1161
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1162 if (!timeo) {
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1163 err = -EAGAIN;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1164 goto out;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1165 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1166 if (signal_pending(current)) {
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1167 err = sock_intr_errno(timeo);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1168 goto out;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1169 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1170
d9dc8b0f8b4ec8 WANG Cong 2016-11-11 1171 add_wait_queue(sk_sleep(sk),
&wait);
d9dc8b0f8b4ec8 WANG Cong 2016-11-11 1172 done = sk_wait_event(sk,
&timeo, atomic_read(&pn->tx_credits), &wait);
d9dc8b0f8b4ec8 WANG Cong 2016-11-11 1173 remove_wait_queue(sk_sleep(sk),
&wait);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1174
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1175 if (sk->sk_state !=
TCP_ESTABLISHED)
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1176 goto disabled;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1177 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1178
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1179 err = pipe_skb_send(sk, skb);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1180 if (err >= 0)
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1181 err = len; /* success! */
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1182 skb = NULL;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1183 out:
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1184 release_sock(sk);
b1704374fd525e Rémi Denis-Courmont 2009-11-09 1185 outfree:
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1186 kfree_skb(skb);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1187 return err;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1188 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1189
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1190 int pep_writeable(struct sock *sk)
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1191 {
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1192 struct pep_sock *pn = pep_sk(sk);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1193
be677730a0ccb6 Rémi Denis-Courmont 2008-12-17 1194 return
atomic_read(&pn->tx_credits);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1195 }
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1196
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1197 int pep_write(struct sock *sk, struct
sk_buff *skb)
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1198 {
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1199 struct sk_buff *rskb, *fs;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1200 int flen = 0;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1201
fea93ecef619b5 Rémi Denis-Courmont 2010-01-04 1202 if (pep_sk(sk)->aligned)
fea93ecef619b5 Rémi Denis-Courmont 2010-01-04 1203 return pipe_skb_send(sk, skb);
fea93ecef619b5 Rémi Denis-Courmont 2010-01-04 1204
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1205 rskb = alloc_skb(MAX_PNPIPE_HEADER,
GFP_ATOMIC);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1206 if (!rskb) {
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1207 kfree_skb(skb);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1208 return -ENOMEM;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1209 }
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1210 skb_shinfo(rskb)->frag_list =
skb;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1211 rskb->len += skb->len;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1212 rskb->data_len += rskb->len;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1213 rskb->truesize += rskb->len;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1214
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1215 /* Avoid nested fragments */
5c313e9a7773ec David S. Miller 2009-06-09 1216 skb_walk_frags(skb, fs)
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1217 flen += fs->len;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1218 skb->next =
skb_shinfo(skb)->frag_list;
5c313e9a7773ec David S. Miller 2009-06-09 1219 skb_frag_list_init(skb);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1220 skb->len -= flen;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1221 skb->data_len -= flen;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1222 skb->truesize -= flen;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1223
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1224 skb_reserve(rskb, MAX_PHONET_HEADER
+ 3);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1225 return pipe_skb_send(sk, rskb);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1226 }
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1227
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1228 struct sk_buff *pep_read(struct sock
*sk)
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1229 {
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1230 struct sk_buff *skb =
skb_dequeue(&sk->sk_receive_queue);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1231
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1232 if (sk->sk_state ==
TCP_ESTABLISHED)
44c9ab16d29a50 Rémi Denis-Courmont 2011-03-08 1233 pipe_grant_credits(sk,
GFP_ATOMIC);
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1234 return skb;
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1235 }
02a47617cdce44 Rémi Denis-Courmont 2008-10-05 1236
1b784140474e4f Ying Xue 2015-03-02 @1237 static int pep_recvmsg(struct sock
*sk, struct msghdr *msg, size_t len,
1b784140474e4f Ying Xue 2015-03-02 1238 int noblock, int flags, int
*addr_len)
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1239 {
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1240 struct sk_buff *skb;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1241 int err;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1242
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1243 if (flags &
~(MSG_OOB|MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_WAITALL|
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1244 MSG_NOSIGNAL|MSG_CMSG_COMPAT))
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1245 return -EOPNOTSUPP;
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1246
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1247 if (unlikely(1 <<
sk->sk_state & (TCPF_LISTEN | TCPF_CLOSE)))
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1248 return -ENOTCONN;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1249
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1250 if ((flags & MSG_OOB) ||
sock_flag(sk, SOCK_URGINLINE)) {
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1251 /* Dequeue and acknowledge control
request */
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1252 struct pep_sock *pn = pep_sk(sk);
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1253
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1254 if (flags & MSG_PEEK)
82ecbcb9c6b525 Rémi Denis-Courmont 2010-01-04 1255 return -EOPNOTSUPP;
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1256 skb =
skb_dequeue(&pn->ctrlreq_queue);
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1257 if (skb) {
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1258 pep_ctrlreq_error(sk, skb,
PN_PIPE_NO_ERROR,
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1259 GFP_KERNEL);
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1260 msg->msg_flags |= MSG_OOB;
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1261 goto copy;
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1262 }
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1263 if (flags & MSG_OOB)
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1264 return -EINVAL;
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1265 }
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1266
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1267 skb = skb_recv_datagram(sk, flags,
noblock, &err);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1268 lock_sock(sk);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1269 if (skb == NULL) {
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1270 if (err == -ENOTCONN &&
sk->sk_state == TCP_CLOSE_WAIT)
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1271 err = -ECONNRESET;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1272 release_sock(sk);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1273 return err;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1274 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1275
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1276 if (sk->sk_state ==
TCP_ESTABLISHED)
44c9ab16d29a50 Rémi Denis-Courmont 2011-03-08 1277 pipe_grant_credits(sk,
GFP_KERNEL);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1278 release_sock(sk);
c41bd97f815720 Rémi Denis-Courmont 2008-10-05 1279 copy:
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1280 msg->msg_flags |= MSG_EOR;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1281 if (skb->len > len)
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1282 msg->msg_flags |= MSG_TRUNC;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1283 else
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1284 len = skb->len;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1285
51f3d02b980a33 David S. Miller 2014-11-05 1286 err = skb_copy_datagram_msg(skb, 0,
msg, len);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1287 if (!err)
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1288 err = (flags & MSG_TRUNC) ?
skb->len : len;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1289
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1290 skb_free_datagram(sk, skb);
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1291 return err;
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1292 }
9641458d3ec42d Rémi Denis-Courmont 2008-10-05 1293
:::::: The code at line 1039 was first introduced by commit
:::::: 02a47617cdce440f60c71a51f3a93f9f5fcc5a7a Phonet: implement GPRS virtual interface
over PEP socket
:::::: TO: Rémi Denis-Courmont <remi.denis-courmont(a)nokia.com>
:::::: CC: David S. Miller <davem(a)davemloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org