* [PATCH AUTOSEL 5.12 018/116] i2c: bail out early when RDWR parameters are wrong
[not found] <20210505163125.3460440-1-sashal@kernel.org>
@ 2021-05-05 16:29 ` Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 044/116] i2c: Add I2C_AQ_NO_REP_START adapter quirk Sasha Levin
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2021-05-05 16:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Wolfram Sang, syzbot+ffb0b3ffa6cfbc7d7b3f, Wolfram Sang,
Sasha Levin, linux-i2c
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
[ Upstream commit 71581562ee36032d2d574a9b23ad4af6d6a64cf7 ]
The buggy parameters currently get caught later, but emit a noisy WARN.
Userspace should not be able to trigger this, so add similar checks much
earlier. Also avoids some unneeded code paths, of course. Apply kernel
coding stlye to a comment while here.
Reported-by: syzbot+ffb0b3ffa6cfbc7d7b3f@syzkaller.appspotmail.com
Tested-by: syzbot+ffb0b3ffa6cfbc7d7b3f@syzkaller.appspotmail.com
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/i2c/i2c-dev.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 6ceb11cc4be1..6ef38a8ee95c 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -440,8 +440,13 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
sizeof(rdwr_arg)))
return -EFAULT;
- /* Put an arbitrary limit on the number of messages that can
- * be sent at once */
+ if (!rdwr_arg.msgs || rdwr_arg.nmsgs == 0)
+ return -EINVAL;
+
+ /*
+ * Put an arbitrary limit on the number of messages that can
+ * be sent at once
+ */
if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS)
return -EINVAL;
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH AUTOSEL 5.12 044/116] i2c: Add I2C_AQ_NO_REP_START adapter quirk
[not found] <20210505163125.3460440-1-sashal@kernel.org>
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 018/116] i2c: bail out early when RDWR parameters are wrong Sasha Levin
@ 2021-05-05 16:30 ` Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 065/116] i2c: imx: Fix PM reference leak in i2c_imx_reg_slave() Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 083/116] i2c: i801: Add support for Intel Alder Lake PCH-M Sasha Levin
3 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2021-05-05 16:30 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Bence Csókás, Wolfram Sang, Sasha Levin, linux-i2c
From: Bence Csókás <bence98@sch.bme.hu>
[ Upstream commit aca01415e076aa96cca0f801f4420ee5c10c660d ]
This quirk signifies that the adapter cannot do a repeated
START, it always issues a STOP condition after transfers.
Suggested-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Bence Csókás <bence98@sch.bme.hu>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/i2c.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 56622658b215..a670ae129f4b 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -687,6 +687,8 @@ struct i2c_adapter_quirks {
#define I2C_AQ_NO_ZERO_LEN_READ BIT(5)
#define I2C_AQ_NO_ZERO_LEN_WRITE BIT(6)
#define I2C_AQ_NO_ZERO_LEN (I2C_AQ_NO_ZERO_LEN_READ | I2C_AQ_NO_ZERO_LEN_WRITE)
+/* adapter cannot do repeated START */
+#define I2C_AQ_NO_REP_START BIT(7)
/*
* i2c_adapter is the structure used to identify a physical i2c bus along
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH AUTOSEL 5.12 065/116] i2c: imx: Fix PM reference leak in i2c_imx_reg_slave()
[not found] <20210505163125.3460440-1-sashal@kernel.org>
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 018/116] i2c: bail out early when RDWR parameters are wrong Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 044/116] i2c: Add I2C_AQ_NO_REP_START adapter quirk Sasha Levin
@ 2021-05-05 16:30 ` Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 083/116] i2c: i801: Add support for Intel Alder Lake PCH-M Sasha Levin
3 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2021-05-05 16:30 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Ye Weihua, Hulk Robot, Wolfram Sang, Sasha Levin, linux-i2c,
linux-arm-kernel
From: Ye Weihua <yeweihua4@huawei.com>
[ Upstream commit c4b1fcc310e655fa8414696c38a84d36c00684c8 ]
pm_runtime_get_sync() will increment the PM reference count even on
failure. Forgetting to put the reference again will result in a leak.
Replace it with pm_runtime_resume_and_get() to keep the usage counter
balanced.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Weihua <yeweihua4@huawei.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/i2c/busses/i2c-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index b80fdc1f0092..5fd8201a14cd 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -801,7 +801,7 @@ static int i2c_imx_reg_slave(struct i2c_client *client)
i2c_imx->last_slave_event = I2C_SLAVE_STOP;
/* Resume */
- ret = pm_runtime_get_sync(i2c_imx->adapter.dev.parent);
+ ret = pm_runtime_resume_and_get(i2c_imx->adapter.dev.parent);
if (ret < 0) {
dev_err(&i2c_imx->adapter.dev, "failed to resume i2c controller");
return ret;
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH AUTOSEL 5.12 083/116] i2c: i801: Add support for Intel Alder Lake PCH-M
[not found] <20210505163125.3460440-1-sashal@kernel.org>
` (2 preceding siblings ...)
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 065/116] i2c: imx: Fix PM reference leak in i2c_imx_reg_slave() Sasha Levin
@ 2021-05-05 16:30 ` Sasha Levin
3 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2021-05-05 16:30 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Jarkko Nikula, Wolfram Sang, Sasha Levin, linux-i2c
From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
[ Upstream commit 8f51c1763ae98bb63fc04627ceae383aa0e8ff7b ]
Add PCI ID of SMBus controller on Intel Alder Lake PCH-M.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/i2c/busses/i2c-i801.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 4acee6f9e5a3..99d446763530 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -73,6 +73,7 @@
* Comet Lake-V (PCH) 0xa3a3 32 hard yes yes yes
* Alder Lake-S (PCH) 0x7aa3 32 hard yes yes yes
* Alder Lake-P (PCH) 0x51a3 32 hard yes yes yes
+ * Alder Lake-M (PCH) 0x54a3 32 hard yes yes yes
*
* Features supported by this driver:
* Software PEC no
@@ -230,6 +231,7 @@
#define PCI_DEVICE_ID_INTEL_ELKHART_LAKE_SMBUS 0x4b23
#define PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS 0x4da3
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_P_SMBUS 0x51a3
+#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_M_SMBUS 0x54a3
#define PCI_DEVICE_ID_INTEL_BROXTON_SMBUS 0x5ad4
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_S_SMBUS 0x7aa3
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS 0x8c22
@@ -1087,6 +1089,7 @@ static const struct pci_device_id i801_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ALDER_LAKE_S_SMBUS) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ALDER_LAKE_P_SMBUS) },
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ALDER_LAKE_M_SMBUS) },
{ 0, }
};
@@ -1771,6 +1774,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
case PCI_DEVICE_ID_INTEL_EBG_SMBUS:
case PCI_DEVICE_ID_INTEL_ALDER_LAKE_S_SMBUS:
case PCI_DEVICE_ID_INTEL_ALDER_LAKE_P_SMBUS:
+ case PCI_DEVICE_ID_INTEL_ALDER_LAKE_M_SMBUS:
priv->features |= FEATURE_BLOCK_PROC;
priv->features |= FEATURE_I2C_BLOCK_READ;
priv->features |= FEATURE_IRQ;
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread