On Fri, Apr 21, 2023 at 04:52:13PM +0200, Dmitry Vyukov wrote: > > Here this: > > size = min_t(unsigned int, size, vi->data_avail); > memcpy(buf, vi->data + vi->data_idx, size); > vi->data_idx += size; > vi->data_avail -= size; > > runs concurrently with: > > if (!virtqueue_get_buf(vi->vq, &vi->data_avail)) > return; > vi->data_idx = 0; > > I did not fully grasp how/where vi->data is populated, but it looks > like it can lead to use of uninit/stale random data, or even to out of > bounds access, say if vi->data_avail is already updated, but > vi->data_idx is not yet reset to 0. Then concurrent reading will read > not where it's supposed to read. This appears to be a genuine bug. I'll look into it. Thanks! -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt