Skip to content

Commit 60daf8d

Browse files
kevin-brodsky-armdavem330
authored andcommitted
net/compat: Update msg_control_is_user when setting a kernel pointer
cmsghdr_from_user_compat_to_kern() is an unusual case w.r.t. how the kmsg->msg_control* fields are used. The input struct msghdr holds a pointer to a user buffer, i.e. ksmg->msg_control_user is active. However, upon success, a kernel pointer is stored in kmsg->msg_control. kmsg->msg_control_is_user should therefore be updated accordingly. Cc: Christoph Hellwig <hch@lst.de> Cc: Eric Dumazet <edumazet@google.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c39ef21 commit 60daf8d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/compat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
211211
goto Einval;
212212

213213
/* Ok, looks like we made it. Hook it up and return success. */
214+
kmsg->msg_control_is_user = false;
214215
kmsg->msg_control = kcmsg_base;
215216
kmsg->msg_controllen = kcmlen;
216217
return 0;

0 commit comments

Comments
 (0)