From: Al Viro <viro@zeniv.linux.org.uk>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Nick Bowler <nbowler@draconx.ca>
Subject: [PATCH net] fix a braino in cmsghdr_from_user_compat_to_kern()
Date: Mon, 27 Jul 2020 19:22:20 +0100 [thread overview]
Message-ID: <20200727182220.GI794331@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20200727161319.GH794331@ZenIV.linux.org.uk>
commit 547ce4cfb34c ("switch cmsghdr_from_user_compat_to_kern() to
copy_from_user()") missed one of the places where ucmlen should've been
replaced with cmsg.cmsg_len, now that we are fetching the entire struct
rather than doing it field-by-field.
As the result, compat sendmsg() with several different-sized cmsg
attached started to fail with EINVAL. Trivial to fix, fortunately.
Reported-by: Nick Bowler <nbowler@draconx.ca>
Tested-by: Nick Bowler <nbowler@draconx.ca>
Fixes: 547ce4cfb34c ("switch cmsghdr_from_user_compat_to_kern() to copy_from_user()")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/net/compat.c b/net/compat.c
index 5e3041a2c37d..434838bef5f8 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -202,7 +202,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
/* Advance. */
kcmsg = (struct cmsghdr *)((char *)kcmsg + tmp);
- ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
+ ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, cmsg.cmsg_len);
}
/*
next prev parent reply other threads:[~2020-07-27 18:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 15:51 PROBLEM: cryptsetup fails to unlock drive in 5.8-rc6 (regression) Nick Bowler
2020-07-27 16:05 ` Al Viro
2020-07-27 16:13 ` [PATCH] " Al Viro
2020-07-27 17:42 ` Nick Bowler
2020-07-27 18:22 ` Al Viro [this message]
2020-07-27 20:25 ` [PATCH net] fix a braino in cmsghdr_from_user_compat_to_kern() David Miller
2020-07-27 16:26 ` PROBLEM: cryptsetup fails to unlock drive in 5.8-rc6 (regression) Nick Bowler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200727182220.GI794331@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=nbowler@draconx.ca \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.