In the Linux kernel, the following vulnerability has been resolved: vsock/virtio: fix potential underflow in virtiotransportgetcredit() The credit calculation in virtiotransportgetcredit() uses unsigned arithmetic: ret = vvs->peerbufalloc - (vvs->txcnt - vvs->peerfwdcnt); If the peer shrinks its advertised buffer (peerbufalloc) while bytes are in flight, the subtraction can underflow and produce a large positive value, potentially allowing more data to be queued than the peer can handle. Reuse virtiotransporthasspace() which already handles this case and add a comment to make it clear why we are doing that. [Stefano: use virtiotransporthas_space() instead of duplicating the code] [Stefano: tweak the commit message]