Skip to content

Commit 656a95c

Browse files
committed
Merge tag 'i2c-for-7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: - sanitize more input parameters in the core (found by syzkaller) - usual set of driver fixes (proper completion handling, applying quirks, correct workqueue selection...) - ID additions to simplify dependency handling - new email address for Peter Rosin * tag 'i2c-for-7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: smbus: reject oversized block transfers in the common path MAINTAINERS: Update mail for Peter Rosin i2c: stub: Reject I2C block transfers with invalid length i2c: Compare the return value of gpiod_get_direction against GPIO_LINE_DIRECTION_OUT i2c: dev: prevent integer overflow in I2C_TIMEOUT ioctl i2c: acpi: Add ELAN0678 to i2c_acpi_force_100khz_device_ids dt-bindings: i2c: apple,i2c: Add t8122 compatible i2c: stm32f7: reinit_completion() per transfer not per msg dt-bindings: i2c: amlogic: Add compatible for T7 SOC i2c: testunit: Replace system_long_wq with system_dfl_long_wq
2 parents bf0e022 + 3051cd0 commit 656a95c

11 files changed

Lines changed: 53 additions & 29 deletions

File tree

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ Peter A Jonsson <pj@ludd.ltu.se>
682682
Peter Hilber <peter.hilber@oss.qualcomm.com> <quic_philber@quicinc.com>
683683
Peter Oruba <peter.oruba@amd.com>
684684
Peter Oruba <peter@oruba.de>
685+
Peter Rosin <peda@lysator.liu.se> <peda@axentia.se>
685686
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev> <pierre-louis.bossart@linux.intel.com>
686687
Pratyush Anand <pratyush.anand@gmail.com> <pratyush.anand@st.com>
687688
Pratyush Yadav <pratyush@kernel.org> <ptyadav@amazon.de>

Documentation/devicetree/bindings/i2c/amlogic,meson6-i2c.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ allOf:
1616

1717
properties:
1818
compatible:
19-
enum:
20-
- amlogic,meson6-i2c # Meson6, Meson8 and compatible SoCs
21-
- amlogic,meson-gxbb-i2c # GXBB and compatible SoCs
22-
- amlogic,meson-axg-i2c # AXG and compatible SoCs
19+
oneOf:
20+
- items:
21+
- enum:
22+
- amlogic,t7-i2c
23+
- const: amlogic,meson-axg-i2c
24+
- enum:
25+
- amlogic,meson6-i2c # Meson6, Meson8 and compatible SoCs
26+
- amlogic,meson-gxbb-i2c # GXBB and compatible SoCs
27+
- amlogic,meson-axg-i2c # AXG and compatible SoCs
2328

2429
reg:
2530
maxItems: 1

Documentation/devicetree/bindings/i2c/apple,i2c.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ properties:
2222
compatible:
2323
oneOf:
2424
- items:
25-
- const: apple,t6020-i2c
25+
- enum:
26+
- apple,t6020-i2c
27+
- apple,t8122-i2c
2628
- const: apple,t8103-i2c
2729
- items:
2830
- enum:

MAINTAINERS

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4299,18 +4299,16 @@ F: Documentation/devicetree/bindings/leds/backlight/awinic,aw99706.yaml
42994299
F: drivers/video/backlight/aw99706.c
43004300

43014301
AXENTIA ARM DEVICES
4302-
M: Peter Rosin <peda@axentia.se>
43034302
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
4304-
S: Maintained
4303+
S: Orphan
43054304
F: arch/arm/boot/dts/microchip/at91-linea.dtsi
43064305
F: arch/arm/boot/dts/microchip/at91-natte.dtsi
43074306
F: arch/arm/boot/dts/microchip/at91-nattis-2-natte-2.dts
43084307
F: arch/arm/boot/dts/microchip/at91-tse850-3.dts
43094308

43104309
AXENTIA ASOC DRIVERS
4311-
M: Peter Rosin <peda@axentia.se>
43124310
L: linux-sound@vger.kernel.org
4313-
S: Maintained
4311+
S: Orphan
43144312
F: Documentation/devicetree/bindings/sound/axentia,*
43154313
F: sound/soc/atmel/tse850-pcm5142.c
43164314

@@ -12050,7 +12048,7 @@ F: Documentation/i2c/busses/i2c-nvidia-gpu.rst
1205012048
F: drivers/i2c/busses/i2c-nvidia-gpu.c
1205112049

1205212050
I2C MUXES
12053-
M: Peter Rosin <peda@axentia.se>
12051+
M: Peter Rosin <peda@lysator.liu.se>
1205412052
L: linux-i2c@vger.kernel.org
1205512053
S: Maintained
1205612054
F: Documentation/devicetree/bindings/i2c/i2c-arb*
@@ -12451,15 +12449,15 @@ F: drivers/iio/industrialio-backend.c
1245112449
F: include/linux/iio/backend.h
1245212450

1245312451
IIO DIGITAL POTENTIOMETER DAC
12454-
M: Peter Rosin <peda@axentia.se>
12452+
M: Peter Rosin <peda@lysator.liu.se>
1245512453
L: linux-iio@vger.kernel.org
1245612454
S: Maintained
1245712455
F: Documentation/ABI/testing/sysfs-bus-iio-dac-dpot-dac
1245812456
F: Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml
1245912457
F: drivers/iio/dac/dpot-dac.c
1246012458

1246112459
IIO ENVELOPE DETECTOR
12462-
M: Peter Rosin <peda@axentia.se>
12460+
M: Peter Rosin <peda@lysator.liu.se>
1246312461
L: linux-iio@vger.kernel.org
1246412462
S: Maintained
1246512463
F: Documentation/ABI/testing/sysfs-bus-iio-adc-envelope-detector
@@ -12475,7 +12473,7 @@ F: include/linux/iio/iio-gts-helper.h
1247512473
F: drivers/iio/test/iio-test-gts.c
1247612474

1247712475
IIO MULTIPLEXER
12478-
M: Peter Rosin <peda@axentia.se>
12476+
M: Peter Rosin <peda@lysator.liu.se>
1247912477
L: linux-iio@vger.kernel.org
1248012478
S: Maintained
1248112479
F: Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
@@ -12506,7 +12504,7 @@ F: include/linux/iio/
1250612504
F: tools/iio/
1250712505

1250812506
IIO UNIT CONVERTER
12509-
M: Peter Rosin <peda@axentia.se>
12507+
M: Peter Rosin <peda@lysator.liu.se>
1251012508
L: linux-iio@vger.kernel.org
1251112509
S: Maintained
1251212510
F: Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml
@@ -15722,7 +15720,7 @@ F: Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml
1572215720
F: drivers/media/i2c/max96717.c
1572315721

1572415722
MAX9860 MONO AUDIO VOICE CODEC DRIVER
15725-
M: Peter Rosin <peda@axentia.se>
15723+
M: Peter Rosin <peda@lysator.liu.se>
1572615724
L: linux-sound@vger.kernel.org
1572715725
S: Maintained
1572815726
F: Documentation/devicetree/bindings/sound/max9860.txt
@@ -15937,7 +15935,7 @@ F: Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml
1593715935
F: drivers/net/can/spi/mcp251xfd/
1593815936

1593915937
MCP4018 AND MCP4531 MICROCHIP DIGITAL POTENTIOMETER DRIVERS
15940-
M: Peter Rosin <peda@axentia.se>
15938+
M: Peter Rosin <peda@lysator.liu.se>
1594115939
L: linux-iio@vger.kernel.org
1594215940
S: Maintained
1594315941
F: Documentation/ABI/testing/sysfs-bus-iio-potentiometer-mcp4531
@@ -18242,7 +18240,7 @@ F: include/linux/mmc/
1824218240
F: include/uapi/linux/mmc/
1824318241

1824418242
MULTIPLEXER SUBSYSTEM
18245-
M: Peter Rosin <peda@axentia.se>
18243+
M: Peter Rosin <peda@lysator.liu.se>
1824618244
S: Odd Fixes
1824718245
F: Documentation/ABI/testing/sysfs-class-mux*
1824818246
F: Documentation/devicetree/bindings/mux/
@@ -19351,7 +19349,7 @@ F: include/dt-bindings/display/tda998x.h
1935119349
K: "nxp,tda998x"
1935219350

1935319351
NXP TFA9879 DRIVER
19354-
M: Peter Rosin <peda@axentia.se>
19352+
M: Peter Rosin <peda@lysator.liu.se>
1935519353
L: linux-sound@vger.kernel.org
1935619354
S: Maintained
1935719355
F: Documentation/devicetree/bindings/sound/trivial-codec.yaml

drivers/i2c/busses/i2c-stm32f7.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,6 @@ static void stm32f7_i2c_xfer_msg(struct stm32f7_i2c_dev *i2c_dev,
895895
f7_msg->result = 0;
896896
f7_msg->stop = (i2c_dev->msg_id >= i2c_dev->msg_num - 1);
897897

898-
reinit_completion(&i2c_dev->complete);
899-
900898
cr1 = readl_relaxed(base + STM32F7_I2C_CR1);
901899
cr2 = readl_relaxed(base + STM32F7_I2C_CR2);
902900

@@ -1728,6 +1726,8 @@ static int stm32f7_i2c_xfer_core(struct i2c_adapter *i2c_adap,
17281726
if (ret)
17291727
goto pm_free;
17301728

1729+
reinit_completion(&i2c_dev->complete);
1730+
17311731
stm32f7_i2c_xfer_msg(i2c_dev, msgs);
17321732

17331733
if (!i2c_dev->atomic)
@@ -2253,7 +2253,7 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
22532253
snprintf(adap->name, sizeof(adap->name), "STM32F7 I2C(%pa)",
22542254
&res->start);
22552255
adap->owner = THIS_MODULE;
2256-
adap->timeout = 2 * HZ;
2256+
adap->timeout = 8 * HZ;
22572257
adap->retries = 3;
22582258
adap->algo = &stm32f7_i2c_algo;
22592259
adap->dev.parent = &pdev->dev;

drivers/i2c/i2c-core-acpi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ static const struct acpi_device_id i2c_acpi_force_100khz_device_ids[] = {
371371
* a 400KHz frequency. The root cause of the issue is not known.
372372
*/
373373
{ "DLL0945", 0 },
374+
{ "ELAN0678", 0 },
374375
{ "ELAN06FA", 0 },
375376
{}
376377
};

drivers/i2c/i2c-core-base.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@ static int i2c_init_recovery(struct i2c_adapter *adap)
445445
bri->set_scl = set_scl_gpio_value;
446446
if (bri->sda_gpiod) {
447447
bri->get_sda = get_sda_gpio_value;
448-
/* FIXME: add proper flag instead of '0' once available */
449-
if (gpiod_get_direction(bri->sda_gpiod) == 0)
448+
if (gpiod_get_direction(bri->sda_gpiod) == GPIO_LINE_DIRECTION_OUT)
450449
bri->set_sda = set_sda_gpio_value;
451450
}
452451
} else if (bri->recover_bus == i2c_generic_scl_recovery) {

drivers/i2c/i2c-core-smbus.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,18 @@ s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
566566
if (res)
567567
return res;
568568

569+
/* Reject invalid caller-supplied block lengths before any
570+
* tracepoint or native smbus_xfer callback runs.
571+
*/
572+
if (data &&
573+
(protocol == I2C_SMBUS_I2C_BLOCK_DATA ||
574+
protocol == I2C_SMBUS_BLOCK_PROC_CALL ||
575+
(protocol == I2C_SMBUS_BLOCK_DATA &&
576+
read_write == I2C_SMBUS_WRITE)) &&
577+
(data->block[0] == 0 ||
578+
data->block[0] > I2C_SMBUS_BLOCK_MAX))
579+
return -EINVAL;
580+
569581
/* If enabled, the following two tracepoints are conditional on
570582
* read_write and protocol.
571583
*/

drivers/i2c/i2c-dev.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,13 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
487487
client->adapter->retries = arg;
488488
break;
489489
case I2C_TIMEOUT:
490-
if (arg > INT_MAX)
490+
/*
491+
* For historical reasons, user-space sets the timeout value in
492+
* units of 10 ms.
493+
*/
494+
if (arg > INT_MAX / 10)
491495
return -EINVAL;
492496

493-
/* For historical reasons, user-space sets the timeout
494-
* value in units of 10 ms.
495-
*/
496497
client->adapter->timeout = msecs_to_jiffies(arg * 10);
497498
break;
498499
default:

drivers/i2c/i2c-slave-testunit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <linux/module.h>
1616
#include <linux/of.h>
1717
#include <linux/slab.h>
18-
#include <linux/workqueue.h> /* FIXME: is system_long_wq the best choice? */
18+
#include <linux/workqueue.h>
1919

2020
#define TU_VERSION_MAX_LENGTH 128
2121

@@ -124,7 +124,7 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client,
124124
case I2C_SLAVE_STOP:
125125
if (tu->reg_idx == TU_NUM_REGS) {
126126
set_bit(TU_FLAG_IN_PROCESS, &tu->flags);
127-
queue_delayed_work(system_long_wq, &tu->worker,
127+
queue_delayed_work(system_dfl_long_wq, &tu->worker,
128128
msecs_to_jiffies(10 * tu->regs[TU_REG_DELAY]));
129129
}
130130

0 commit comments

Comments
 (0)