From: Michal Kubecek <mkubecek@suse.cz>
To: netdev@vger.kernel.org
Cc: David Miller <davem@davemloft.net>,
vivien.didelot@gmail.com, linux-kernel@vger.kernel.org,
kernel@savoirfairelinux.com, linville@redhat.com,
f.fainelli@gmail.com
Subject: Re: [PATCH net-next] ethtool: copy reglen to userspace
Date: Thu, 30 May 2019 08:48:48 +0200 [thread overview]
Message-ID: <20190530064848.GA27401@unicorn.suse.cz> (raw)
In-Reply-To: <20190529.221744.1136074795446305909.davem@davemloft.net>
On Wed, May 29, 2019 at 10:17:44PM -0700, David Miller wrote:
> From: Vivien Didelot <vivien.didelot@gmail.com>
> Date: Tue, 28 May 2019 16:58:48 -0400
>
> > ethtool_get_regs() allocates a buffer of size reglen obtained from
> > ops->get_regs_len(), thus only this value must be used when copying
> > the buffer back to userspace. Also no need to check regbuf twice.
> >
> > Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
>
> Hmmm, can't regs.len be modified by the driver potentially?
The driver certainly shouldn't raise it as that could result in kernel
writing past the buffer provided by userspace. (I'll check some drivers
to see if they truncate the dump or return an error if regs.len from
userspace is insufficient.) And lowering it would be also wrong as that
would mean dump would be shorter than what ops->get_regs_len() returned.
Michal Kubecek
next prev parent reply other threads:[~2019-05-30 6:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 20:58 Vivien Didelot
2019-05-30 5:17 ` David Miller
2019-05-30 6:48 ` Michal Kubecek [this message]
2019-05-30 8:27 ` Michal Kubecek
2019-05-30 18:26 ` David Miller
2019-05-30 23:38 ` Vivien Didelot
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=20190530064848.GA27401@unicorn.suse.cz \
--to=mkubecek@suse.cz \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linville@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
/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
all inboxes | Powered by JetHome®