<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/net/ethernet/intel/e100.c, branch linux-4.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-10-06T08:22:25Z</updated>
<entry>
<title>e100: fix buffer overrun in e100_get_regs</title>
<updated>2021-10-06T08:22:25Z</updated>
<author>
<name>Jacob Keller</name>
</author>
<published>2021-09-08T17:52:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6f2ba2bee361feefec355ac9a3e39be4a87cd64e'/>
<id>urn:sha1:6f2ba2bee361feefec355ac9a3e39be4a87cd64e</id>
<content type='text'>
[ Upstream commit 51032e6f17ce990d06123ad7307f258c50d25aa7 ]

The e100_get_regs function is used to implement a simple register dump
for the e100 device. The data is broken into a couple of MAC control
registers, and then a series of PHY registers, followed by a memory dump
buffer.

The total length of the register dump is defined as (1 + E100_PHY_REGS)
* sizeof(u32) + sizeof(nic-&gt;mem-&gt;dump_buf).

The logic for filling in the PHY registers uses a convoluted inverted
count for loop which counts from E100_PHY_REGS (0x1C) down to 0, and
assigns the slots 1 + E100_PHY_REGS - i. The first loop iteration will
fill in [1] and the final loop iteration will fill in [1 + 0x1C]. This
is actually one more than the supposed number of PHY registers.

The memory dump buffer is then filled into the space at
[2 + E100_PHY_REGS] which will cause that memcpy to assign 4 bytes past
the total size.

The end result is that we overrun the total buffer size allocated by the
kernel, which could lead to a panic or other issues due to memory
corruption.

It is difficult to determine the actual total number of registers
here. The only 8255x datasheet I could find indicates there are 28 total
MDI registers. However, we're reading 29 here, and reading them in
reverse!

In addition, the ethtool e100 register dump interface appears to read
the first PHY register to determine if the device is in MDI or MDIx
mode. This doesn't appear to be documented anywhere within the 8255x
datasheet. I can only assume it must be in register 28 (the extra
register we're reading here).

Lets not change any of the intended meaning of what we copy here. Just
extend the space by 4 bytes to account for the extra register and
continue copying the data out in the same order.

Change the E100_PHY_REGS value to be the correct total (29) so that the
total register dump size is calculated properly. Fix the offset for
where we copy the dump buffer so that it doesn't overrun the total size.

Re-write the for loop to use counting up instead of the convoluted
down-counting. Correct the mdio_read offset to use the 0-based register
offsets, but maintain the bizarre reverse ordering so that we have the
ABI expected by applications like ethtool. This requires and additional
subtraction of 1. It seems a bit odd but it makes the flow of assignment
into the register buffer easier to follow.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Felicitas Hetzelt &lt;felicitashetzelt@gmail.com&gt;
Signed-off-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Tested-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Signed-off-by: Tony Nguyen &lt;anthony.l.nguyen@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>e100: fix length calculation in e100_get_regs_len</title>
<updated>2021-10-06T08:22:24Z</updated>
<author>
<name>Jacob Keller</name>
</author>
<published>2021-09-08T17:52:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a8226d694768459c2fb28e4c53a7f01e3daf9fd5'/>
<id>urn:sha1:a8226d694768459c2fb28e4c53a7f01e3daf9fd5</id>
<content type='text'>
[ Upstream commit 4329c8dc110b25d5f04ed20c6821bb60deff279f ]

commit abf9b902059f ("e100: cleanup unneeded math") tried to simplify
e100_get_regs_len and remove a double 'divide and then multiply'
calculation that the e100_reg_regs_len function did.

This change broke the size calculation entirely as it failed to account
for the fact that the numbered registers are actually 4 bytes wide and
not 1 byte. This resulted in a significant under allocation of the
register buffer used by e100_get_regs.

Fix this by properly multiplying the register count by u32 first before
adding the size of the dump buffer.

Fixes: abf9b902059f ("e100: cleanup unneeded math")
Reported-by: Felicitas Hetzelt &lt;felicitashetzelt@gmail.com&gt;
Signed-off-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Signed-off-by: Tony Nguyen &lt;anthony.l.nguyen@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>e100: handle eeprom as little endian</title>
<updated>2021-07-20T14:22:37Z</updated>
<author>
<name>Jesse Brandeburg</name>
</author>
<published>2021-03-26T00:38:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6d8dc2c7c1ee3aae9ed9d4a3e35c95e9f997893f'/>
<id>urn:sha1:6d8dc2c7c1ee3aae9ed9d4a3e35c95e9f997893f</id>
<content type='text'>
[ Upstream commit d4ef55288aa2e1b76033717242728ac98ddc4721 ]

Sparse tool was warning on some implicit conversions from
little endian data read from the EEPROM on the e100 cards.

Fix these by being explicit about the conversions using
le16_to_cpu().

Signed-off-by: Jesse Brandeburg &lt;jesse.brandeburg@intel.com&gt;
Signed-off-by: Tony Nguyen &lt;anthony.l.nguyen@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait</title>
<updated>2019-12-21T09:35:33Z</updated>
<author>
<name>YueHaibing</name>
</author>
<published>2018-11-19T12:48:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e3378548c554280da40a4ea822579b0c0eec8412'/>
<id>urn:sha1:e3378548c554280da40a4ea822579b0c0eec8412</id>
<content type='text'>
[ Upstream commit cd0d465bb697a9c7bf66a9fe940f7981232f1676 ]

Fix a static code checker warning:
drivers/net/ethernet/intel/e100.c:1349
 e100_load_ucode_wait() warn: passing zero to 'PTR_ERR'

Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Tested-by: Aaron Brown &lt;aaron.f.brown@intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>e100: Release skb when DMA mapping is failed in e100_xmit_prepare</title>
<updated>2015-08-18T21:06:05Z</updated>
<author>
<name>Jia-Ju Bai</name>
</author>
<published>2015-08-03T02:40:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5e5d49422dfb035ca9e280cd61d434095c151272'/>
<id>urn:sha1:5e5d49422dfb035ca9e280cd61d434095c151272</id>
<content type='text'>
When pci_dma_mapping_error in e100_xmit_prepare is failed, the skb buffer
allocated by netdev_alloc_skb_ip_align in e100_rx_alloc_skb is not
released, which causes a possible resource leak.
This patch adds error handling code to fix it.

Signed-off-by: Jia-Ju Bai &lt;baijiaju1990@163.com&gt;
Tested-by: Aaron Brown &lt;aaron.f.brown@intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
</content>
</entry>
<entry>
<title>e100: Add a check after pci_pool_create to avoid null pointer dereference</title>
<updated>2015-08-18T21:06:05Z</updated>
<author>
<name>Jia-Ju Bai</name>
</author>
<published>2015-08-03T02:17:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9ad607b4a9cb365fbd8387b1250ec448e497223e'/>
<id>urn:sha1:9ad607b4a9cb365fbd8387b1250ec448e497223e</id>
<content type='text'>
The driver lacks the check of nic-&gt;cbs_pool after pci_pool_create
in e100_probe. When this function is failed, a null pointer dereference
occurs when pci_pool_alloc uses nic-&gt;cbs_pool in e100_alloc_cbs.
This patch adds a check and related error handling code to fix it.

Signed-off-by: Jia-Ju Bai &lt;baijiaju1990@163.com&gt;
Tested-by: Aaron Brown &lt;aaron.f.brown@intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
</content>
</entry>
<entry>
<title>ethernet/intel: Use setup_timer</title>
<updated>2015-06-01T04:46:01Z</updated>
<author>
<name>Vaishali Thakkar</name>
</author>
<published>2015-06-01T04:43:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f16e9d86ae435d7ee6e9eaceb8ba1cf3b1895b72'/>
<id>urn:sha1:f16e9d86ae435d7ee6e9eaceb8ba1cf3b1895b72</id>
<content type='text'>
Use the timer API function setup_timer instead of structure field
assignments to initialize a timer.

A simplified version of the Coccinelle semantic patch that performs
this transformation is as follows:

@change@
expression e1, e2, e3, e4, a, b;
@@

-init_timer(&amp;e1);
+setup_timer(&amp;e1, a, b);

... when != a = e2
    when != b = e3

-e1.function = a;
... when != b = e4
-e1.data = b;

Signed-off-by: Vaishali Thakkar &lt;vthakkar1994@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>e100: don't initialize int object to zero</title>
<updated>2015-05-04T08:18:06Z</updated>
<author>
<name>Jean Sacren</name>
</author>
<published>2015-05-02T07:49:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ac7c1c5af946e0f9fa6555c48c55236bae175042'/>
<id>urn:sha1:ac7c1c5af946e0f9fa6555c48c55236bae175042</id>
<content type='text'>
'err' will be overwritten so no need to initialize it to zero.

Signed-off-by: Jean Sacren &lt;sakiwit@gmail.com&gt;
Tested-by: Aaron Brown &lt;aaron.f.brown@intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
</content>
</entry>
<entry>
<title>e100: Use dma_rmb/wmb where appropriate</title>
<updated>2015-04-09T18:25:26Z</updated>
<author>
<name>Alexander Duyck</name>
</author>
<published>2015-04-09T01:49:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c335869fb934ebcccab69315f1cbe7b34f6d9414'/>
<id>urn:sha1:c335869fb934ebcccab69315f1cbe7b34f6d9414</id>
<content type='text'>
Reduce the CPU overhead for transmit and receive by using lightweight dma_
barriers instead of full barriers where they are applicable.

Cc: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
Signed-off-by: Alexander Duyck &lt;alexander.h.duyck@redhat.com&gt;
Acked-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>ethernet: codespell comment spelling fixes</title>
<updated>2015-03-09T02:54:22Z</updated>
<author>
<name>Joe Perches</name>
</author>
<published>2015-03-07T04:49:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dbedd44e982d61c156337b1a3fb252b24085f8e3'/>
<id>urn:sha1:dbedd44e982d61c156337b1a3fb252b24085f8e3</id>
<content type='text'>
To test a checkpatch spelling patch, I ran codespell against
drivers/net/ethernet/.

$ git ls-files drivers/net/ethernet/ | \
  while read file ; do \
    codespell -w $file; \
  done

I removed a false positive in e1000_hw.h

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