public inbox for [email protected]
 help / color / mirror / Atom feed
From: Victor Stewart <[email protected]>
To: io-uring <[email protected]>,
	Soheil Hassas Yeganeh <[email protected]>,
	netdev <[email protected]>,
	Stefan Metzmacher <[email protected]>
Subject: [PATCH 1/3] add PROTO_CMSG_DATA_ONLY to __sys_sendmsg_sock
Date: Sat, 12 Dec 2020 15:31:36 +0000	[thread overview]
Message-ID: <CAM1kxwgKVrpV-4UV5wKyEGbh61N1Bb1s0=pkK8kSp6Z-i3zTKg@mail.gmail.com> (raw)

add PROTO_CMSG_DATA_ONLY whitelisting to __sys_sendmsg_sock

Signed-off by: Victor Stewart <[email protected]>
---
 net/socket.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 6e6cccc2104f..6995835d6355 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2416,9 +2416,11 @@ static int ___sys_sendmsg(struct socket *sock,
struct user_msghdr __user *msg,
 long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg,
                        unsigned int flags)
 {
-       /* disallow ancillary data requests from this path */
-       if (msg->msg_control || msg->msg_controllen)
-               return -EINVAL;
+       if (msg->msg_control || msg->msg_controllen) {
+               /* disallow ancillary data reqs unless cmsg is plain data */
+               if (!(sock->ops->flags & PROTO_CMSG_DATA_ONLY))
+                       return -EINVAL;
+       }

        return ____sys_sendmsg(sock, msg, flags, NULL, 0);
 }

                 reply	other threads:[~2020-12-12 15:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAM1kxwgKVrpV-4UV5wKyEGbh61N1Bb1s0=pkK8kSp6Z-i3zTKg@mail.gmail.com' \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox