<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/cmd/i2c.c, branch v2023.07.01</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/u-boot.git/atom/cmd/i2c.c?h=v2023.07.01</id>
<link rel='self' href='http://cgit.235523.xyz/u-boot.git/atom/cmd/i2c.c?h=v2023.07.01'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<updated>2022-12-23T15:15:12Z</updated>
<entry>
<title>global: Migrate CONFIG_SYS_I2C_DIRECT_BUS to CFG</title>
<updated>2022-12-23T15:15:12Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2022-12-04T15:13:57Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=d8964b3e1d7233a1b45679c57985575ec0056022'/>
<id>urn:sha1:d8964b3e1d7233a1b45679c57985575ec0056022</id>
<content type='text'>
Perform a simple rename of CONFIG_SYS_I2C_DIRECT_BUS to CFG_SYS_I2C_DIRECT_BUS

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
</entry>
<entry>
<title>i2c: Remove CONFIG_I2C_MULTI_BUS</title>
<updated>2022-12-22T15:31:48Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2022-12-02T21:42:30Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1353b25ec58eba4cd26f4101ebb1b6047838a105'/>
<id>urn:sha1:1353b25ec58eba4cd26f4101ebb1b6047838a105</id>
<content type='text'>
This functionality is part of the legacy I2C subsystem and is currently
unused anywhere.  Remove the remaining references.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
</entry>
<entry>
<title>global: Move remaining CONFIG_SYS_* to CFG_SYS_*</title>
<updated>2022-12-05T21:06:08Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2022-11-16T18:10:41Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=65cc0e2a65d2c9f107b2f42db6396d9ade6c5ad8'/>
<id>urn:sha1:65cc0e2a65d2c9f107b2f42db6396d9ade6c5ad8</id>
<content type='text'>
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
</entry>
<entry>
<title>global: Move remaining CONFIG_SYS_NUM_* to CFG_SYS_NUM_*</title>
<updated>2022-12-05T21:06:07Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2022-11-16T18:10:29Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=cdc5ed8f1f2add27105151ecf61a07c5d4c3684a'/>
<id>urn:sha1:cdc5ed8f1f2add27105151ecf61a07c5d4c3684a</id>
<content type='text'>
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_NUM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
</entry>
<entry>
<title>i2c: fix stack buffer overflow vulnerability in i2c md command</title>
<updated>2022-08-31T16:21:47Z</updated>
<author>
<name>Marek Vasut</name>
<email>marex@denx.de</email>
</author>
<published>2022-08-26T21:15:56Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=e4573fef7701afc2df22924ce0a445b923475afc'/>
<id>urn:sha1:e4573fef7701afc2df22924ce0a445b923475afc</id>
<content type='text'>
This reinstates fix from commit 8f8c04bf1ebb ("i2c: fix stack buffer
overflow vulnerability in i2c md command") without the changes unrelated
to the actual fix. Avoid the underflow by setting only nbytes and
linebytes as unsigned integers.

Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: Heiko Schocher &lt;hs@denx.de&gt;
Cc: Nicolas Iooss &lt;nicolas.iooss+uboot@ledger.fr&gt;
Cc: Simon Glass &lt;sjg@chromium.org&gt;
Cc: Tim Harvey &lt;tharvey@gateworks.com&gt;
Acked-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
</content>
</entry>
<entry>
<title>Revert "i2c: fix stack buffer overflow vulnerability in i2c md command"</title>
<updated>2022-08-31T16:21:31Z</updated>
<author>
<name>Marek Vasut</name>
<email>marex@denx.de</email>
</author>
<published>2022-08-26T21:15:55Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1aa9a04ff687b8d55b0fb68ae2a688c8705665cc'/>
<id>urn:sha1:1aa9a04ff687b8d55b0fb68ae2a688c8705665cc</id>
<content type='text'>
This reverts commit 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409.

The commit is largely wrong and breaks most of i2c command functionality.
The problem described in the aforementioned commit commit message is valid,
however the commit itself does many more changes unrelated to fixing that
one problem it describes. Those extra changes, namely the handling of i2c
device address length as unsigned instead of signed integer, breaks the
expectation that address length may be negative value. The negative value
is used by DM to indicate that address length of device does not change.

The actual bug documented in commit 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409
can be fixed by extra sanitization in separate patch.

Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: Heiko Schocher &lt;hs@denx.de&gt;
Cc: Nicolas Iooss &lt;nicolas.iooss+uboot@ledger.fr&gt;
Cc: Simon Glass &lt;sjg@chromium.org&gt;
Cc: Tim Harvey &lt;tharvey@gateworks.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
</entry>
<entry>
<title>i2c: fix stack buffer overflow vulnerability in i2c md command</title>
<updated>2022-06-28T19:51:56Z</updated>
<author>
<name>Nicolas Iooss</name>
<email>nicolas.iooss+uboot@ledger.fr</email>
</author>
<published>2022-06-10T14:50:25Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409'/>
<id>urn:sha1:8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409</id>
<content type='text'>
When running "i2c md 0 0 80000100", the function do_i2c_md parses the
length into an unsigned int variable named length. The value is then
moved to a signed variable:

    int nbytes = length;
    #define DISP_LINE_LEN 16
    int linebytes = (nbytes &gt; DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
    ret = dm_i2c_read(dev, addr, linebuf, linebytes);

On systems where integers are 32 bits wide, 0x80000100 is a negative
value to "nbytes &gt; DISP_LINE_LEN" is false and linebytes gets assigned
0x80000100 instead of 16.

The consequence is that the function which reads from the i2c device
(dm_i2c_read or i2c_read) is called with a 16-byte stack buffer to fill
but with a size parameter which is too large. In some cases, this could
trigger a crash. But with some i2c drivers, such as drivers/i2c/nx_i2c.c
(used with "nexell,s5pxx18-i2c" bus), the size is actually truncated to
a 16-bit integer. This is because function i2c_transfer expects an
unsigned short length. In such a case, an attacker who can control the
response of an i2c device can overwrite the return address of a function
and execute arbitrary code through Return-Oriented Programming.

Fix this issue by using unsigned integers types in do_i2c_md. While at
it, make also alen unsigned, as signed sizes can cause vulnerabilities
when people forgot to check that they can be negative.

Signed-off-by: Nicolas Iooss &lt;nicolas.iooss+uboot@ledger.fr&gt;
Reviewed-by: Heiko Schocher &lt;hs@denx.de&gt;
</content>
</entry>
<entry>
<title>cmd/i2c.c: Remove unused legacy code</title>
<updated>2021-08-30T18:10:07Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2021-08-19T03:12:31Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1edef7693b576f7ab208a697bb01f033b68041fb'/>
<id>urn:sha1:1edef7693b576f7ab208a697bb01f033b68041fb</id>
<content type='text'>
There are no longer any cases where we are neither SYS_I2C_LEGACY nor
DM_I2C.  Remove these code paths.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
</entry>
<entry>
<title>Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY</title>
<updated>2021-08-30T18:10:07Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2021-08-19T03:12:24Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=55dabcc8f24598e2777f663de09ab55fbe1269da'/>
<id>urn:sha1:55dabcc8f24598e2777f663de09ab55fbe1269da</id>
<content type='text'>
First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig.  Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL.  Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support.  Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
</entry>
<entry>
<title>Convert CONFIG_SYS_I2C_EEPROM_ADDR et al to Kconfig</title>
<updated>2021-08-30T18:10:06Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2021-08-17T21:59:45Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=88cd7d0ea961ca11b1eeaaea8b7811573b103abb'/>
<id>urn:sha1:88cd7d0ea961ca11b1eeaaea8b7811573b103abb</id>
<content type='text'>
- Rename usages of CONFIG_SYS_DEF_EEPROM_ADDR to CONFIG_SYS_I2C_EEPROM_ADDR
  based on current usage.
- Convert CONFIG_SYS_I2C_EEPROM_ADDR, CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
  CONFIG_SYS_I2C_EEPROM_BUS, CONFIG_CONFIG_SYS_EEPROM_SIZE
  CONFIG_SYS_EEPROM_PAGE_WRITE_BITS and CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
  to Kconfig.  We move these symbols around a bit and add appropriate
  dependencies to them.  In some cases, we now add a correct default value
  as well.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
</entry>
</feed>
