From: John Fastabend <john.fastabend@gmail.com>
To: Tom Herbert <tom@quantonium.net>, netdev@vger.kernel.org
Cc: rohit@quantonium.net
Subject: Re: [PATCH net-next 1/3] proto_ops: Add locked held versions of sendmsg and sendpage
Date: Thu, 03 Aug 2017 12:49:30 -0700 [thread overview]
Message-ID: <59837E4A.1010409@gmail.com> (raw)
In-Reply-To: <20170728232243.3040-2-tom@quantonium.net>
On 07/28/2017 04:22 PM, Tom Herbert wrote:
> Add new proto_ops sendmsg_locked and sendpage_locked that can be
> called when the socket lock is already held. Correspondingly, add
> kernel_sendmsg_locked and kernel_sendpage_locked as front end
> functions.
>
> These functions will be used in zero proxy so that we can take
> the socket lock in a ULP sendmsg/sendpage and then directly call the
> backend transport proto_ops functions.
>
> Signed-off-by: Tom Herbert <tom@quantonium.net>
> ---
[...]
> diff --git a/net/socket.c b/net/socket.c
> index 79d9bb964cd8..c0a12ad39610 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -652,6 +652,20 @@ int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
> }
> EXPORT_SYMBOL(kernel_sendmsg);
>
> +int kernel_sendmsg_locked(struct sock *sk, struct msghdr *msg,
> + struct kvec *vec, size_t num, size_t size)
> +{
> + struct socket *sock = sk->sk_socket;
> +
> + if (!sock->ops->sendmsg_locked)
> + sock_no_sendmsg_locked(sk, msg, size);
> +
Should be
return sock_no_sendmsg_locked(sk, msg, size);
> + iov_iter_kvec(&msg->msg_iter, WRITE | ITER_KVEC, vec, num, size);
> +
> + return sock->ops->sendmsg_locked(sk, msg, msg_data_left(msg));
Otherwise this is a null ptr deref.
> +}
> +EXPORT_SYMBOL(kernel_sendmsg_locked);
> +
Thanks,
John
next prev parent reply other threads:[~2017-08-03 19:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 23:22 [PATCH net-next 0/3] net: Infrastructure changes for [kz]proxy Tom Herbert
2017-07-28 23:22 ` [PATCH net-next 1/3] proto_ops: Add locked held versions of sendmsg and sendpage Tom Herbert
2017-08-03 19:49 ` John Fastabend [this message]
2017-08-03 20:21 ` John Fastabend
2017-08-03 21:07 ` Tom Herbert
2017-07-28 23:22 ` [PATCH net-next 2/3] skbuff: Function to send an skbuf on a socket Tom Herbert
2017-08-03 19:51 ` John Fastabend
2017-07-28 23:22 ` [PATCH net-next 3/3] strparser: Generalize strparser Tom Herbert
2017-10-19 17:42 ` Eric Dumazet
[not found] ` <CALx6S3765-5oT6UtSQVts4KwWz3F3ub2vhDWO7YemYZPPM0EjA@mail.gmail.com>
2017-10-19 20:18 ` John Fastabend
2017-08-01 22:26 ` [PATCH net-next 0/3] net: Infrastructure changes for [kz]proxy David Miller
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=59837E4A.1010409@gmail.com \
--to=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rohit@quantonium.net \
--cc=tom@quantonium.net \
/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;
as well as URLs for NNTP newsgroup(s).