Message ID | 7a62778e680d8d6201d5f7b00341e7d06aa67c0d.camel@kernel.crashing.org |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] i2c: Fix multiple-enqueue of the same request on NACK | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | master/apply_patch Successfully applied |
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes: > i2c_request_send() will retry the request if the error is a NAK, > however it forgets to clear the "ud.done" flag. It will thus > loop again and try to re-enqueue the same request causing internal > request list corruption. > > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > --- > core/i2c.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) Cheers, series merged as of: master ef79d0370737130256168d20a9bf40f06001af88 6.0.x 9844f12ea28eee7c8d07c76043b5fdb170d6cd6a
diff --git a/core/i2c.c b/core/i2c.c index d4311c27..070a0f6f 100644 --- a/core/i2c.c +++ b/core/i2c.c @@ -224,11 +224,10 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write, rc = ud.rc; - if (rc == OPAL_I2C_NACK_RCVD) - continue; - else - /* error or success */ + /* error or success */ + if (rc != OPAL_I2C_NACK_RCVD) break; + ud.done = false; } prlog(PR_DEBUG, "I2C: %s req op=%x offset=%x buf=%016llx buflen=%d "
i2c_request_send() will retry the request if the error is a NAK, however it forgets to clear the "ud.done" flag. It will thus loop again and try to re-enqueue the same request causing internal request list corruption. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- core/i2c.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)