From: David Ahern <dsahern@kernel.org>
To: dccp@vger.kernel.org
Subject: Re: [PATCH net-next v3] net: ioctl: Use kernel memory on protocol ioctl callbacks
Date: Thu, 25 May 2023 15:34:12 +0000 [thread overview]
Message-ID: <a1074987-c3ce-56cd-3005-beb5a3c55ef9@kernel.org> (raw)
In-Reply-To: <20230525125503.400797-1-leitao@debian.org>
On 5/25/23 9:05 AM, Willem de Bruijn wrote:
>> +/* A wrapper around sock ioctls, which copies the data from userspace
>> + * (depending on the protocol/ioctl), and copies back the result to userspace.
>> + * The main motivation for this function is to pass kernel memory to the
>> + * protocol ioctl callbacks, instead of userspace memory.
>> + */
>> +int sk_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
>> +{
>> + int rc = 1;
>> +
>> + if (ipmr_is_sk(sk))
>> + rc = ipmr_sk_ioctl(sk, cmd, arg);
>> + else if (ip6mr_is_sk(sk))
>> + rc = ip6mr_sk_ioctl(sk, cmd, arg);
>> + else if (phonet_is_sk(sk))
>> + rc = phonet_sk_ioctl(sk, cmd, arg);
>
> I don't understand what this buys us vs testing the sk_family,
> sk_protocol and cmd here.
To keep protocol specific code out of core files is the reason I
suggested it.
>
> It introduces even deeper dependencies on the protocol specific
> header files. And the CONFIG issues that result from that. And it
> adds a bunch of wrappers that are only used once.
>
next prev parent reply other threads:[~2023-05-25 15:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-25 12:54 [PATCH net-next v3] net: ioctl: Use kernel memory on protocol ioctl callbacks Breno Leitao
2023-05-25 14:19 ` Eric Dumazet
2023-05-25 14:54 ` Simon Horman
2023-05-25 15:03 ` David Ahern
2023-05-25 15:05 ` Willem de Bruijn
2023-05-25 15:34 ` David Ahern [this message]
2023-05-25 16:06 ` Willem de Bruijn
2023-05-26 8:49 ` Breno Leitao
2023-05-26 9:08 ` Breno Leitao
2023-05-26 14:09 ` Willem de Bruijn
2023-05-28 18:05 ` kernel test robot
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=a1074987-c3ce-56cd-3005-beb5a3c55ef9@kernel.org \
--to=dsahern@kernel.org \
--cc=dccp@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox