From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: drivers/vhost: sizing of ubuf_info and heads Date: Fri, 08 Mar 2013 13:57:09 +1100 Message-ID: <87hakmwqd6.fsf@rustcorp.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org To: Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: netdev.vger.kernel.org Hi Michael, I'm a bit confused about why ubuf_info and heads are UIO_MAXIOV length arrays, rather than being the size of the ring? In particular, this is suspicious: linux/drivers/vhost/net.c:342: struct ubuf_info *ubuf = &vq->ubuf_info[head]; And it seems to assume we trust head: a malicious guest could put the same head entry in the ring twice, and we will get two callbacks on the same value. I don't know what that will do, but I'm not sure it's harmless. Thanks, Rusty.