diff mbox

[v1] HID: cp2112: fix I2C_SMBUS_BYTE write

Message ID 1436504871-3676-1-git-send-email-ellen@cumulusnetworks.com
State Superseded
Headers show

Commit Message

Ellen Wang July 10, 2015, 5:07 a.m. UTC
When doing an I2C_SMBUS_BYTE write (one byte write, no address),
the data to be written is in "command" not "data->byte".
---
 drivers/hid/hid-cp2112.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Kosina July 13, 2015, 11:20 a.m. UTC | #1
On Thu, 9 Jul 2015, Ellen Wang wrote:

> When doing an I2C_SMBUS_BYTE write (one byte write, no address),
> the data to be written is in "command" not "data->byte".

This is missing Signoff.

How serious is this bug in practice? Is this 4.2 material?

Thanks,
Ellen Wang July 13, 2015, 10:28 p.m. UTC | #2
On 7/13/2015 4:20 AM, Jiri Kosina wrote:
> On Thu, 9 Jul 2015, Ellen Wang wrote:
>
>> When doing an I2C_SMBUS_BYTE write (one byte write, no address),
>> the data to be written is in "command" not "data->byte".
>
> This is missing Signoff.

Sorry.  I submitted v2.

> How serious is this bug in practice? Is this 4.2 material?

The driver segfaults without the fix, and this is a common operation. 
On the other hand, the cp2112 is an uncommon device.

(I would personally like all the cp2112 fixes to be in 4.1 eventually. 
They are all important functional improvements.)
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index a3703b8..7afc3fc 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -606,7 +606,7 @@  static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
 		if (I2C_SMBUS_READ == read_write)
 			count = cp2112_read_req(buf, addr, read_length);
 		else
-			count = cp2112_write_req(buf, addr, data->byte, NULL,
+			count = cp2112_write_req(buf, addr, command, NULL,
 						 0);
 		break;
 	case I2C_SMBUS_BYTE_DATA: