From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCHv3] vhost-net: fix use-after-free in vhost_net_flush Date: Tue, 09 Jul 2013 12:56:24 -0700 (PDT) Message-ID: <20130709.125624.1456063645210971879.davem@davemloft.net> References: <20130707112653.GA31232@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org To: mst@redhat.com Return-path: In-Reply-To: <20130707112653.GA31232@redhat.com> 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 From: "Michael S. Tsirkin" Date: Sun, 7 Jul 2013 14:26:53 +0300 > vhost_net_ubuf_put_and_wait has a confusing name: > it will actually also free it's argument. > Thus since commit 1280c27f8e29acf4af2da914e80ec27c3dbd5c01 > "vhost-net: flush outstanding DMAs on memory change" > vhost_net_flush tries to use the argument after passing it > to vhost_net_ubuf_put_and_wait, this results > in use after free. > To fix, don't free the argument in vhost_net_ubuf_put_and_wait, > add an new API for callers that want to free ubufs. > > Acked-by: Asias He > Acked-by: Jason Wang > Signed-off-by: Michael S. Tsirkin Applied and queued up for -stable.