From: Ben Hutchings <bhutchings@solarflare.com>
To: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Cc: netdev <netdev@vger.kernel.org>, David Miller <davem@davemloft.net>
Subject: Re: [net-next-2.6 PATCH] ethtool: Support to take FW dump
Date: Wed, 04 May 2011 02:06:34 +0100 [thread overview]
Message-ID: <1304471194.3203.5.camel@localhost> (raw)
In-Reply-To: <2941C562-0D47-40DF-B2C0-6292381097AE@qlogic.com>
On Tue, 2011-05-03 at 17:29 -0700, Anirban Chakraborty wrote:
> On May 3, 2011, at 4:53 PM, Ben Hutchings wrote:
>
> > On Mon, 2011-05-02 at 16:29 -0700, anirban.chakraborty@qlogic.com wrote:
[...]
> >> +static int ethtool_get_dump_data(struct net_device *dev,
> >> + void __user *useraddr)
> >> +{
> >> + int ret;
> >> + void *data;
> >> + struct ethtool_dump dump;
> >> + const struct ethtool_ops *ops = dev->ethtool_ops;
> >> +
> >> + if (!dev->ethtool_ops->get_dump_data)
> >> + return -EOPNOTSUPP;
> >> +
> >> + if (copy_from_user(&dump, useraddr, sizeof(dump)))
> >> + return -EFAULT;
> >> + data = vzalloc(dump.len);
> >
> > I think we ought to query the driver to find out the maximum dump
> > length, rather than using the length passed by the user (up to 4GB). We
> > already check that the user has the CAP_NET_ADMIN capability but that
> > should not mean the ability to evade memory limits.
> That's right. The user makes a call to get_dump (ETHTOOL_GET_DUMP)
> first to get the size of the collected dump data for the current
> dump level (flag). Then it makes the call to get the dump data (ETHTOOL_GET_DUMP_DATA),
> as in above where it specifies the dump size.
> The patch ref-ed below demonstrated that.
> http://patchwork.ozlabs.org/patch/93729/
[...]
I understand that the userland application will need to get the size
that way. I'm saying that this code in the kernel should also get the
size from the driver, so that a malicious application cannot make the
kernel allocate an excessively large buffer.
Also, you'll need to submit your implementation along with this, as
David won't accept an extension to the API without a driver that
implements it.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2011-05-04 1:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 23:29 [ethtool PATCH] FW dump support anirban.chakraborty
2011-05-02 23:29 ` [net-next-2.6 PATCH] ethtool: Support to take FW dump anirban.chakraborty
2011-05-03 23:53 ` Ben Hutchings
2011-05-04 0:29 ` Anirban Chakraborty
2011-05-04 1:06 ` Ben Hutchings [this message]
2011-05-04 5:22 ` Anirban Chakraborty
2011-05-04 17:40 ` [ethtool PATCH] FW dump support Ben Hutchings
2011-05-04 18:02 ` Anirban Chakraborty
2011-05-04 18:07 ` Ben Hutchings
2011-05-04 18:15 ` Ajit.Khaparde
2011-05-04 18:25 ` Ben Hutchings
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=1304471194.3203.5.camel@localhost \
--to=bhutchings@solarflare.com \
--cc=anirban.chakraborty@qlogic.com \
--cc=davem@davemloft.net \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).