CVE-2024-35984: i2c: smbus: fix NULL function pointer dereference
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
i2c: smbus: fix NULL function pointer dereference
Baruch reported an OOPS when using the designware controller as target only. Target-only modes break the assumption of one transfer function always being available. Fix this by always checking the pointer in __i2c_transfer.
[wsa: dropped the simplification in core-smbus to avoid theoretical regressions]
The Linux kernel CVE team has assigned CVE-2024-35984 to this issue.
Affected and fixed versions
===========================
Issue introduced in 3.19 with commit 4b1acc43331d and fixed in 4.19.313 with commit 40f1d79f07b4 Issue introduced in 3.19 with commit 4b1acc43331d and fixed in 5.4.275 with commit ad3c3ac7a03b Issue introduced in 3.19 with commit 4b1acc43331d and fixed in 5.10.216 with commit 5fd72404587d Issue introduced in 3.19 with commit 4b1acc43331d and fixed in 5.15.158 with commit 5a09eae9a7db Issue introduced in 3.19 with commit 4b1acc43331d and fixed in 6.1.90 with commit 4e75e222d397 Issue introduced in 3.19 with commit 4b1acc43331d and fixed in 6.6.30 with commit e3425674ff68 Issue introduced in 3.19 with commit 4b1acc43331d and fixed in 6.8.9 with commit 357c64ef1ef3 Issue introduced in 3.19 with commit 4b1acc43331d and fixed in 6.9 with commit 91811a31b68d
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2024-35984
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/i2c/i2c-core-base.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/40f1d79f07b49c8a64a861706e5163f2db4bd95d https://git.kernel.org/stable/c/ad3c3ac7a03be3697114f781193dd3e9d97e6e23 https://git.kernel.org/stable/c/5fd72404587d7db4acb2d241fd8c387afb0a7aec https://git.kernel.org/stable/c/5a09eae9a7db597fe0c1fc91636205b4a25d2620 https://git.kernel.org/stable/c/4e75e222d397c6752b229ed72fc4644c8c36ecde https://git.kernel.org/stable/c/e3425674ff68dc521c57c6eabad0cbd20a027d85 https://git.kernel.org/stable/c/357c64ef1ef39b1e7cd91ab6bdd304d043702c83 https://git.kernel.org/stable/c/91811a31b68d3765b3065f4bb6d7d6d84a7cfc9f