Skip to content
Browse files

net: socket: userspace: Copy user specified value in getsockopt()

User could have set something to optval in getsockopt() and we
need to copy the data to kernel optval so that the socket family
code can use the value for something.

Signed-off-by: Jukka Rissanen <>
  • Loading branch information...
jukkar committed Jul 23, 2019
1 parent aaafb6a commit 1a9e09c85ce05d432725e993ecf9d774d08da76d
Showing with 2 additions and 1 deletion.
  1. +2 −1 subsys/net/lib/sockets/sockets.c
@@ -1119,7 +1119,8 @@ Z_SYSCALL_HANDLER(zsock_getsockopt, sock, level, optname, optval, optlen)
return -1;

kernel_optval = z_thread_malloc(kernel_optlen);
kernel_optval = z_user_alloc_from_copy((const void *)optval,

ret = z_impl_zsock_getsockopt(sock, level, optname,

0 comments on commit 1a9e09c

Please sign in to comment.
You can’t perform that action at this time.