* [ethtool PATCH] ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info
@ 2012-07-11 21:16 Alexander Duyck
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Duyck @ 2012-07-11 21:16 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, jeffrey.t.kirsher, alexander.duyck
The ethtool function for getting the rule count was not zeroing out the
data field before passing it to the kernel. As a result the value started
uninitialized and was incorrectly returning a result indicating that
devices supported setting new rule indexes. In order to correct this I am
adding a one line fix that sets data to zero before we pass the command to
the kernel.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
rxclass.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rxclass.c b/rxclass.c
index 4d49aa6..e1633a8 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -207,6 +207,7 @@ static int rxclass_get_dev_info(struct cmd_context *ctx, __u32 *count,
int err;
nfccmd.cmd = ETHTOOL_GRXCLSRLCNT;
+ nfccmd.data = 0;
err = send_ioctl(ctx, &nfccmd);
*count = nfccmd.rule_cnt;
if (driver_select)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [ethtool PATCH] ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info
@ 2012-07-13 16:55 Alexander Duyck
2012-07-16 20:03 ` Ben Hutchings
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Duyck @ 2012-07-13 16:55 UTC (permalink / raw)
To: netdev, bhutchings; +Cc: jeffrey.t.kirsher
The ethtool function for getting the rule count was not zeroing out the
data field before passing it to the kernel. As a result the value started
uninitialized and was incorrectly returning a result indicating that
devices supported setting new rule indexes. In order to correct this I am
adding a one line fix that sets data to zero before we pass the command to
the kernel.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
I am resending this since I didn't see any notification that it had been seen.
I also realized that I had not clearly identified that this is an ethtool user
space patch and not an ethtool kernel space patch.
rxclass.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rxclass.c b/rxclass.c
index 4d49aa6..e1633a8 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -207,6 +207,7 @@ static int rxclass_get_dev_info(struct cmd_context *ctx, __u32 *count,
int err;
nfccmd.cmd = ETHTOOL_GRXCLSRLCNT;
+ nfccmd.data = 0;
err = send_ioctl(ctx, &nfccmd);
*count = nfccmd.rule_cnt;
if (driver_select)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [ethtool PATCH] ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info
2012-07-13 16:55 [ethtool PATCH] ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info Alexander Duyck
@ 2012-07-16 20:03 ` Ben Hutchings
2012-07-17 0:10 ` Alexander Duyck
0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2012-07-16 20:03 UTC (permalink / raw)
To: Alexander Duyck; +Cc: netdev, jeffrey.t.kirsher
On Fri, 2012-07-13 at 09:55 -0700, Alexander Duyck wrote:
> The ethtool function for getting the rule count was not zeroing out the
> data field before passing it to the kernel. As a result the value started
> uninitialized and was incorrectly returning a result indicating that
> devices supported setting new rule indexes. In order to correct this I am
> adding a one line fix that sets data to zero before we pass the command to
> the kernel.
Right. For 'get' commands with no parameters (besides the device) the
data copied back to userland is normally zero-initialised and then
filled out by the driver, and I seem to have worked on that assumption.
But because of the odd multiplexing of RX NFC commands
ETHTOOL_GRXCLSRLCNT doesn't work like that. And for 'my' driver that
didn't matter. Sorry about that.
(We should really have some explicit documentation of responsibility for
structure initialisation.)
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
>
> I am resending this since I didn't see any notification that it had been seen.
> I also realized that I had not clearly identified that this is an ethtool user
> space patch and not an ethtool kernel space patch.
It was perfectly clear and I had queued it up to review but hadn't yet
done so.
Ben.
> rxclass.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/rxclass.c b/rxclass.c
> index 4d49aa6..e1633a8 100644
> --- a/rxclass.c
> +++ b/rxclass.c
> @@ -207,6 +207,7 @@ static int rxclass_get_dev_info(struct cmd_context *ctx, __u32 *count,
> int err;
>
> nfccmd.cmd = ETHTOOL_GRXCLSRLCNT;
> + nfccmd.data = 0;
> err = send_ioctl(ctx, &nfccmd);
> *count = nfccmd.rule_cnt;
> if (driver_select)
>
--
Ben Hutchings, Staff 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ethtool PATCH] ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info
2012-07-16 20:03 ` Ben Hutchings
@ 2012-07-17 0:10 ` Alexander Duyck
2012-07-17 15:32 ` Ben Hutchings
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Duyck @ 2012-07-17 0:10 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev, jeffrey.t.kirsher
On 07/16/2012 01:03 PM, Ben Hutchings wrote:
> On Fri, 2012-07-13 at 09:55 -0700, Alexander Duyck wrote:
>> The ethtool function for getting the rule count was not zeroing out the
>> data field before passing it to the kernel. As a result the value started
>> uninitialized and was incorrectly returning a result indicating that
>> devices supported setting new rule indexes. In order to correct this I am
>> adding a one line fix that sets data to zero before we pass the command to
>> the kernel.
> Right. For 'get' commands with no parameters (besides the device) the
> data copied back to userland is normally zero-initialised and then
> filled out by the driver, and I seem to have worked on that assumption.
> But because of the odd multiplexing of RX NFC commands
> ETHTOOL_GRXCLSRLCNT doesn't work like that. And for 'my' driver that
> didn't matter. Sorry about that.
>
> (We should really have some explicit documentation of responsibility for
> structure initialisation.)
>
>> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>> ---
>>
>> I am resending this since I didn't see any notification that it had been seen.
>> I also realized that I had not clearly identified that this is an ethtool user
>> space patch and not an ethtool kernel space patch.
> It was perfectly clear and I had queued it up to review but hadn't yet
> done so.
>
> Ben.
>
Yeah, that was my mistake. I thought I hadn't sent it out with the
ethtool prefix when I actually had.
Thanks,
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ethtool PATCH] ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info
2012-07-17 0:10 ` Alexander Duyck
@ 2012-07-17 15:32 ` Ben Hutchings
0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2012-07-17 15:32 UTC (permalink / raw)
To: Alexander Duyck; +Cc: netdev, jeffrey.t.kirsher
On Mon, 2012-07-16 at 17:10 -0700, Alexander Duyck wrote:
> On 07/16/2012 01:03 PM, Ben Hutchings wrote:
> > On Fri, 2012-07-13 at 09:55 -0700, Alexander Duyck wrote:
> >> The ethtool function for getting the rule count was not zeroing out the
> >> data field before passing it to the kernel. As a result the value started
> >> uninitialized and was incorrectly returning a result indicating that
> >> devices supported setting new rule indexes. In order to correct this I am
> >> adding a one line fix that sets data to zero before we pass the command to
> >> the kernel.
> > Right. For 'get' commands with no parameters (besides the device) the
> > data copied back to userland is normally zero-initialised and then
> > filled out by the driver, and I seem to have worked on that assumption.
> > But because of the odd multiplexing of RX NFC commands
> > ETHTOOL_GRXCLSRLCNT doesn't work like that. And for 'my' driver that
> > didn't matter. Sorry about that.
> >
> > (We should really have some explicit documentation of responsibility for
> > structure initialisation.)
> >
> >> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> >> ---
> >>
> >> I am resending this since I didn't see any notification that it had been seen.
> >> I also realized that I had not clearly identified that this is an ethtool user
> >> space patch and not an ethtool kernel space patch.
> > It was perfectly clear and I had queued it up to review but hadn't yet
> > done so.
> >
> > Ben.
> >
> Yeah, that was my mistake. I thought I hadn't sent it out with the
> ethtool prefix when I actually had.
So, anyway, I've applied it and just done a bug fix release (3.4.2).
Ben.
--
Ben Hutchings, Staff 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-17 15:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13 16:55 [ethtool PATCH] ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info Alexander Duyck
2012-07-16 20:03 ` Ben Hutchings
2012-07-17 0:10 ` Alexander Duyck
2012-07-17 15:32 ` Ben Hutchings
-- strict thread matches above, loose matches on Subject: below --
2012-07-11 21:16 Alexander Duyck
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).