mbox series

[v2,0/2] virtio-i2c: Fix buffer handling

Message ID 20211111160412.11980-1-vincent.whitchurch@axis.com
Headers show
Series virtio-i2c: Fix buffer handling | expand

Message

Vincent Whitchurch Nov. 11, 2021, 4:04 p.m. UTC
This fixes a couple of bugs in the buffer handling in virtio-i2c which can
result in incorrect data on the I2C bus or memory corruption in the guest.

I tested this on UML (virtio-uml needs a bug fix too, I will sent that out
later) with the device implementation in rust-vmm/vhost-device.

Changes in v2:
- Added Acked-by and Fixes tags

Vincent Whitchurch (2):
  i2c: virtio: disable timeout handling
  i2c: virtio: fix completion handling

 drivers/i2c/busses/i2c-virtio.c | 46 ++++++++++++++-------------------
 1 file changed, 19 insertions(+), 27 deletions(-)

Comments

Michael S. Tsirkin Nov. 24, 2021, 11:55 p.m. UTC | #1
On Thu, Nov 11, 2021 at 05:04:10PM +0100, Vincent Whitchurch wrote:
> This fixes a couple of bugs in the buffer handling in virtio-i2c which can
> result in incorrect data on the I2C bus or memory corruption in the guest.
> 
> I tested this on UML (virtio-uml needs a bug fix too, I will sent that out
> later) with the device implementation in rust-vmm/vhost-device.
> 
> Changes in v2:
> - Added Acked-by and Fixes tags


What are the plans for this patchset?

> Vincent Whitchurch (2):
>   i2c: virtio: disable timeout handling
>   i2c: virtio: fix completion handling
> 
>  drivers/i2c/busses/i2c-virtio.c | 46 ++++++++++++++-------------------
>  1 file changed, 19 insertions(+), 27 deletions(-)
> 
> -- 
> 2.28.0
Viresh Kumar Nov. 25, 2021, 3:21 a.m. UTC | #2
On 24-11-21, 18:55, Michael S. Tsirkin wrote:
> On Thu, Nov 11, 2021 at 05:04:10PM +0100, Vincent Whitchurch wrote:
> > This fixes a couple of bugs in the buffer handling in virtio-i2c which can
> > result in incorrect data on the I2C bus or memory corruption in the guest.
> > 
> > I tested this on UML (virtio-uml needs a bug fix too, I will sent that out
> > later) with the device implementation in rust-vmm/vhost-device.
> > 
> > Changes in v2:
> > - Added Acked-by and Fixes tags
> 
> 
> What are the plans for this patchset?

Wolfram applied the first patch, but not the second.

Wolfram, you can apply that one as well, it looks okay.
Wolfram Sang Nov. 25, 2021, 6:24 a.m. UTC | #3
> Wolfram, you can apply that one as well, it looks okay.

Is it? I read that the code only waits for the last request while
Michael suggested to wait for all of them? And he did not ack patch 2
while he acked patch 1. Did I misunderstand?
Viresh Kumar Nov. 25, 2021, 6:47 a.m. UTC | #4
On 25-11-21, 07:24, Wolfram Sang wrote:
> 
> > Wolfram, you can apply that one as well, it looks okay.
> 
> Is it? I read that the code only waits for the last request while
> Michael suggested to wait for all of them? And he did not ack patch 2
> while he acked patch 1. Did I misunderstand?

Okay, I misread it then.

To clarify, we should initialize the completion for each buffer and
wait for all of them to be completed before returning back to the
user.

Lets wait for an update by Vincent for that then.