Commit 16b89f69 authored by Kees Cook's avatar Kees Cook

net/scm: Fix typo in SCM_RIGHTS compat refactoring

When refactoring the SCM_RIGHTS code, I accidentally mis-merged my
native/compat diffs, which entirely broke using SCM_RIGHTS in compat
mode. Use the correct helper.
Reported-by: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
Link: https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216156.htmlReported-by: default avatar"Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
Link: https://lore.kernel.org/lkml/1596812929.lz7fuo8r2w.none@localhost/Suggested-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fixes: c0029de5 ("net/scm: Regularize compat handling of scm_detach_fds()")
Tested-by: default avatarAlex Xu (Hello71) <alex_y_xu@yahoo.ca>
Acked-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 25d8d4ee
...@@ -294,7 +294,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm) ...@@ -294,7 +294,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
(struct compat_cmsghdr __user *)msg->msg_control; (struct compat_cmsghdr __user *)msg->msg_control;
unsigned int o_flags = (msg->msg_flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0; unsigned int o_flags = (msg->msg_flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0;
int fdmax = min_t(int, scm_max_fds_compat(msg), scm->fp->count); int fdmax = min_t(int, scm_max_fds_compat(msg), scm->fp->count);
int __user *cmsg_data = CMSG_USER_DATA(cm); int __user *cmsg_data = CMSG_COMPAT_DATA(cm);
int err = 0, i; int err = 0, i;
for (i = 0; i < fdmax; i++) { for (i = 0; i < fdmax; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment