LKML Archive on
help / color / mirror / Atom feed
From: Jakub Kicinski <>
To: Peter Collingbourne <>
Cc: David Laight <>,
	"David S. Miller" <>,
	Colin Ian King <>,
	Cong Wang <>,
	Al Viro <>,
	Greg KH <>,
	Arnd Bergmann <>,
	"" <>,
	"" <>,
	"" <>
Subject: Re: [PATCH v2] net: don't unconditionally copy_from_user a struct ifreq for socket ioctls
Date: Wed, 1 Sep 2021 16:20:11 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, 1 Sep 2021 11:01:32 -0700 Peter Collingbourne wrote:
> > > To stop the copy_from_user() faulting when the user buffer
> > > isn't long enough.
> > > In particular for iasatty() on arm with tagged pointers.  
> >
> > Let me rephrase. is_socket_ioctl_cmd() is always true here. There were
> > only two callers, both check cmd is of specific, "sockety" type.  
> I see, it looks like we don't need the check on the compat path then.
> I can send a followup to clean this up but given that I got a comment
> from another reviewer saying that we should try to make the native and
> compat paths as similar as possible, maybe it isn't too bad to leave
> things as is?

I have a weak preference to get rid of it, the code is a little
complex and extra dead code makes it harder to follow, but up to you.

IMO the "right place" for the check is:

static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
			/* --> here <-- */
			err = sock_do_ioctl(net, sock, cmd, arg);

Since that's the point where we take all the remaining cmd values and
call a function which assumes struct ifreq.

Compat code does not have a default statement.

But as I said no big deal, feel free to ignore.

      reply	other threads:[~2021-09-01 23:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 19:46 Peter Collingbourne
2021-08-27  8:50 ` patchwork-bot+netdevbpf
2021-08-31 16:30 ` Jakub Kicinski
2021-09-01  8:22   ` David Laight
2021-09-01 14:03     ` Jakub Kicinski
2021-09-01 18:01       ` Peter Collingbourne
2021-09-01 23:20         ` Jakub Kicinski [this message]

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v2] net: don'\''t unconditionally copy_from_user a struct ifreq for socket ioctls' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).