From: Ben Hutchings <bhutchings@solarflare.com>
To: Ajit Khaparde <ajitk@serverengines.com>
Cc: davem@davemloft.net, jgarzik@pobox.com, netdev@vger.kernel.org
Subject: Re: [net-next-2.6 PATCH] net/ethtool: Add support to the ethtool feature to flash firmware image from a specified file.
Date: Fri, 14 Aug 2009 21:58:57 +0100 [thread overview]
Message-ID: <1250283537.2782.3.camel@achroite> (raw)
In-Reply-To: <20090814173314.GA26218@serverengines.com>
On Fri, 2009-08-14 at 23:03 +0530, Ajit Khaparde wrote:
> This patch adds support to flash a firmware image to a device using ethtool.
> The driver gets the filename of the firmware image and flashes this image
> using the request_firmware() path.
>
> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
> ---
> include/linux/ethtool.h | 8 ++++++++
> net/core/ethtool.c | 17 +++++++++++++++++
> 2 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 90c4a36..243cdce 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -362,6 +362,12 @@ struct ethtool_rxnfc {
> __u32 rule_locs[0];
> };
>
> +/* for passing firmware flashing related parameters */
> +struct ethtool_flash {
> + __u32 cmd;
> + __u8 *data;
There also needs to be some sort of identifier to distinguish different
flash regions.
[...]
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -898,6 +898,20 @@ static int ethtool_set_value(struct net_device *dev, char __user *useraddr,
> return actor(dev, edata.data);
> }
>
> +static int ethtool_flash_device(struct net_device *dev, char __user *useraddr)
> +{
> + int err;
> + struct ethtool_flash efl;
> +
> + if (copy_from_user(&efl, useraddr, sizeof(efl)))
> + return -EFAULT;
[...]
This leaves efl.data as a user-space pointer, not a kernel-space
pointer. The string will then also need to be copied. It's simpler to
embed the string in the structure, though that means putting a limit on
the string length.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
prev parent reply other threads:[~2009-08-14 20:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-14 17:33 [net-next-2.6 PATCH] net/ethtool: Add support to the ethtool feature to flash firmware image from a specified file Ajit Khaparde
2009-08-14 20:58 ` Ben Hutchings [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:
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=1250283537.2782.3.camel@achroite \
--to=bhutchings@solarflare.com \
--cc=ajitk@serverengines.com \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--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).