Skip to content

Commit 859431a

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Better input validation for compat ioctls and a documentation bugfix for 5.16" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: Docs: Fixes link to I2C specification i2c: validate user data in compat ioctl
2 parents 1286cc4 + c116fe1 commit 859431a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Documentation/i2c/summary.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ systems. Some systems use variants that don't meet branding requirements,
1111
and so are not advertised as being I2C but come under different names,
1212
e.g. TWI (Two Wire Interface), IIC.
1313

14-
The official I2C specification is the `"I2C-bus specification and user
15-
manual" (UM10204) <https://www.nxp.com/docs/en/user-guide/UM10204.pdf>`_
16-
published by NXP Semiconductors.
14+
The latest official I2C specification is the `"I2C-bus specification and user
15+
manual" (UM10204) <https://www.nxp.com/webapp/Download?colCode=UM10204>`_
16+
published by NXP Semiconductors. However, you need to log-in to the site to
17+
access the PDF. An older version of the specification (revision 6) is archived
18+
`here <https://web.archive.org/web/20210813122132/https://www.nxp.com/docs/en/user-guide/UM10204.pdf>`_.
1719

1820
SMBus (System Management Bus) is based on the I2C protocol, and is mostly
1921
a subset of I2C protocols and signaling. Many I2C devices will work on an

drivers/i2c/i2c-dev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,9 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
535535
sizeof(rdwr_arg)))
536536
return -EFAULT;
537537

538+
if (!rdwr_arg.msgs || rdwr_arg.nmsgs == 0)
539+
return -EINVAL;
540+
538541
if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS)
539542
return -EINVAL;
540543

0 commit comments

Comments
 (0)