<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/core/ethtool.c, branch linux-2.6.34.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.34.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.34.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2011-04-17T20:15:37Z</updated>
<entry>
<title>net: clear heap allocation for ETHTOOL_GRXCLSRLALL</title>
<updated>2011-04-17T20:15:37Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2010-10-07T10:03:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5fdf1fe64e1713adaccb5c9e7151a1ff3fda2db1'/>
<id>urn:sha1:5fdf1fe64e1713adaccb5c9e7151a1ff3fda2db1</id>
<content type='text'>
commit ae6df5f96a51818d6376da5307d773baeece4014 upstream.

Calling ETHTOOL_GRXCLSRLALL with a large rule_cnt will allocate kernel
heap without clearing it. For the one driver (niu) that implements it,
it will leave the unused portion of heap unchanged and copy the full
contents back to userspace.

Signed-off-by: Kees Cook &lt;kees.cook@canonical.com&gt;
Acked-by: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>net: clear heap allocations for privileged ethtool actions</title>
<updated>2011-01-06T23:08:14Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2010-10-11T19:23:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a621db98fc8cc7b5b513a51ee93df75537256850'/>
<id>urn:sha1:a621db98fc8cc7b5b513a51ee93df75537256850</id>
<content type='text'>
commit b00916b189d13a615ff05c9242201135992fcda3 upstream.

Several other ethtool functions leave heap uncleared (potentially) by
drivers. Some interfaces appear safe (eeprom, etc), in that the sizes
are well controlled. In some situations (e.g. unchecked error conditions),
the heap will remain unchanged in areas before copying back to userspace.
Note that these are less of an issue since these all require CAP_NET_ADMIN.

[PG: 34 doesn't have ethtool_get_rxnfc(), drop that chunk]

Signed-off-by: Kees Cook &lt;kees.cook@canonical.com&gt;
Acked-by: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>ethtool: Fix potential user buffer overflow for ETHTOOL_{G, S}RXFH</title>
<updated>2010-08-02T17:30:05Z</updated>
<author>
<name>Ben Hutchings</name>
</author>
<published>2010-07-28T22:59:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2a8b96d1e1100fbd27aaa69ea760dd10e38ab9cf'/>
<id>urn:sha1:2a8b96d1e1100fbd27aaa69ea760dd10e38ab9cf</id>
<content type='text'>
commit bf988435bd5b53529f4408a8efb1f433f6ddfda9 upstream.

struct ethtool_rxnfc was originally defined in 2.6.27 for the
ETHTOOL_{G,S}RXFH command with only the cmd, flow_type and data
fields.  It was then extended in 2.6.30 to support various additional
commands.  These commands should have been defined to use a new
structure, but it is too late to change that now.

Since user-space may still be using the old structure definition
for the ETHTOOL_{G,S}RXFH commands, and since they do not need the
additional fields, only copy the originally defined fields to and
from user-space.

Signed-off-by: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>ethtool: Fix potential kernel buffer overflow in ETHTOOL_GRXCLSRLALL</title>
<updated>2010-08-02T17:29:49Z</updated>
<author>
<name>Ben Hutchings</name>
</author>
<published>2010-06-28T08:44:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b2ae72c4a8c172cd4fbe987c0f90764e5b63c55c'/>
<id>urn:sha1:b2ae72c4a8c172cd4fbe987c0f90764e5b63c55c</id>
<content type='text'>
commit db048b69037e7fa6a7d9e95a1271a50dc08ae233 upstream.

On a 32-bit machine, info.rule_cnt &gt;= 0x40000000 leads to integer
overflow and the buffer may be smaller than needed.  Since
ETHTOOL_GRXCLSRLALL is unprivileged, this can presumably be used for at
least denial of service.

Signed-off-by: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h</title>
<updated>2010-03-30T13:02:32Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2010-03-24T08:04:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a0e3ad6af8660be21ca98a971cd00f331318c05'/>
<id>urn:sha1:5a0e3ad6af8660be21ca98a971cd00f331318c05</id>
<content type='text'>
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -&gt; slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Guess-its-ok-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Lee Schermerhorn &lt;Lee.Schermerhorn@hp.com&gt;
</content>
</entry>
<entry>
<title>ethtool: Use noinline_for_stack</title>
<updated>2010-03-08T20:17:04Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-03-08T20:17:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f5c445ed4148434f142be0263a8ad7cb58503e8a'/>
<id>urn:sha1:f5c445ed4148434f142be0263a8ad7cb58503e8a</id>
<content type='text'>
Use self documenting noinline_for_stack instead of duplicated comments.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ethtool: Add direct access to ops-&gt;get_sset_count</title>
<updated>2010-03-05T22:00:17Z</updated>
<author>
<name>Jeff Garzik</name>
</author>
<published>2010-03-04T08:21:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d17792ebdf90289c9fd1bce888076d3d60ecd53b'/>
<id>urn:sha1:d17792ebdf90289c9fd1bce888076d3d60ecd53b</id>
<content type='text'>
On 03/04/2010 09:26 AM, Ben Hutchings wrote:
&gt; On Thu, 2010-03-04 at 00:51 -0800, Jeff Kirsher wrote:
&gt;&gt; From: Jeff Garzik&lt;jgarzik@redhat.com&gt;
&gt;&gt;
&gt;&gt; This patch is an alternative approach for accessing string
&gt;&gt; counts, vs. the drvinfo indirect approach.  This way the drvinfo
&gt;&gt; space doesn't run out, and we don't break ABI later.
&gt; [...]
&gt;&gt; --- a/net/core/ethtool.c
&gt;&gt; +++ b/net/core/ethtool.c
&gt;&gt; @@ -214,6 +214,10 @@ static noinline int ethtool_get_drvinfo(struct net_device *dev, void __user *use
&gt;&gt;   	info.cmd = ETHTOOL_GDRVINFO;
&gt;&gt;   	ops-&gt;get_drvinfo(dev,&amp;info);
&gt;&gt;
&gt;&gt; +	/*
&gt;&gt; +	 * this method of obtaining string set info is deprecated;
&gt;&gt; +	 * consider using ETHTOOL_GSSET_INFO instead
&gt;&gt; +	 */
&gt;
&gt; This comment belongs on the interface (ethtool.h) not the
&gt; implementation.

Debatable -- the current comment is located at the callsite of
ops-&gt;get_sset_count(), which is where an implementor might think to add
a new call.  Not all the numeric fields in ethtool_drvinfo are obtained
from -&gt;get_sset_count().

Hence the "some" in the attached patch to include/linux/ethtool.h,
addressing your comment.

&gt; [...]
&gt;&gt; +static noinline int ethtool_get_sset_info(struct net_device *dev,
&gt;&gt; +                                          void __user *useraddr)
&gt;&gt; +{
&gt; [...]
&gt;&gt; +	/* calculate size of return buffer */
&gt;&gt; +	for (i = 0; i&lt;  64; i++)
&gt;&gt; +		if (sset_mask&amp;  (1ULL&lt;&lt;  i))
&gt;&gt; +			n_bits++;
&gt; [...]
&gt;
&gt; We have a function for this:
&gt;
&gt; 	n_bits = hweight64(sset_mask);

Agreed.

I've attached a follow-up patch, which should enable my/Jeff's kernel
patch to be applied, followed by this one.

Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ethtool: Add direct access to ops-&gt;get_sset_count</title>
<updated>2010-03-05T22:00:17Z</updated>
<author>
<name>Jeff Garzik</name>
</author>
<published>2010-03-03T22:51:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=723b2f57ad83ee7087acf9a95e8e289414b1f521'/>
<id>urn:sha1:723b2f57ad83ee7087acf9a95e8e289414b1f521</id>
<content type='text'>
This patch is an alternative approach for accessing string
counts, vs. the drvinfo indirect approach.  This way the drvinfo
space doesn't run out, and we don't break ABI later.

Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
Signed-off-by: Peter P Waskiewicz Jr &lt;peter.p.waskiewicz.jr@intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ethtool: do not set some flags, if others failed</title>
<updated>2010-02-28T09:40:30Z</updated>
<author>
<name>Jeff Garzik</name>
</author>
<published>2010-02-26T21:43:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9675478bbafed08848bf8d7e28400d5e46330b23'/>
<id>urn:sha1:9675478bbafed08848bf8d7e28400d5e46330b23</id>
<content type='text'>
NETIF_F_NTUPLE flag setting introduced a bug:  non-ntuple flags
like LRO may be successfully set, before ioctl(2) returns failure
to userspace.

The set-flags operation should be all-or-none, rather than leaving
things in an inconsistent state prior to reporting failure to
userspace.

Signed-off-by: Jeff Garzik &lt;jgarzik@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Revert "ethtool: Add n-tuple string length to drvinfo and return it"</title>
<updated>2010-02-26T13:12:02Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2010-02-26T13:12:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=738b0343e73604750feb107e063c28b3ca36cb84'/>
<id>urn:sha1:738b0343e73604750feb107e063c28b3ca36cb84</id>
<content type='text'>
This reverts commit c79c5ffdce14abb4de3878c5aa8c3c6e5093c69b.

As Jeff points out we can't break the user visible interface
like this, we need to add this into the reserved[] thing.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
