Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp464162yba; Wed, 15 May 2019 04:34:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtDrWqLfBsaFsgOBGHlhToADAKbvXXXUEBJtVo3Yo8YNpTCXw6JNbxefNuXcvc1ZLjBflL X-Received: by 2002:a63:8949:: with SMTP id v70mr44558480pgd.196.1557920070034; Wed, 15 May 2019 04:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920070; cv=none; d=google.com; s=arc-20160816; b=x6eN3RLuzuIPOr8rdZV1eoi1k3tpglm+tY9wYWHWqgQ+N6wKkI9ba+kzY8l/0my78c pQokl4oHqYYbPylk+8NMfMPh/tGnmgxBaoGteGnhat1feNO1QDDJHMW8cXOaEhegAS44 AWvfoCzjG7CRtVaQAtPPoIa5UpqrnzKas9M/9sxbYIm+kvNBeZzRHvnVhYyX67RNV5ir bMQ9yYULQRSNsETZECYIkYW3WWHV/u62IvrwUnLwJwocSw2TQiL0RSxw/SUTlwosNLyJ 8rCewHVHl+DAI37IMwLWDchySzYKLp/KDzylbH3U6FEGJxZNmuFVLAxDsFuSk2lQdmiV ql7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hAfNLKVjCoElf6kC4hXub3sHJdDI4k0crl/rH11Qbzg=; b=sAz26v8tT7WjgtAb0R3DrXAPH1Wnd9YBnGmLCq623lvgBb7HxtHeZCTWZsktEIafDQ UEhqzc+BdHryH+55cbCOk6rfN8wy9LfEty4qMH3SZeWZwxiTbo5vbYN7pOVth3l5GFWd gU8Mlci/e9vCumc66SXwn25q0a/Wv6Jra2CCb++B3cTIynnoNOnkhp9qvWMzLt2rhzoB 0piZQDCjUIevvrnnMsM3zj3fwJmCYwCdnde3Y0XmhekbMoS4EbRn1+jKx2KQmVRe+i65 ZqlGBTj5QDSSsPQ+7KeZbJTW3z9eGsxL0nMRAaaa/27ixkOta6qVqT6bliOtwPIcuWyp mrPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C4KBKLSr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si1863251pfo.248.2019.05.15.04.34.15; Wed, 15 May 2019 04:34:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C4KBKLSr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731502AbfEOLbb (ORCPT + 99 others); Wed, 15 May 2019 07:31:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:43264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731386AbfEOLb3 (ORCPT ); Wed, 15 May 2019 07:31:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B34EE20818; Wed, 15 May 2019 11:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919889; bh=oIQEaM9ehbUGjQp2n7XmPHer5wa2e7e8ImVmL2y+yzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C4KBKLSrNRZjSq8tND2BrWyA4cuhsiDY/TCITx3AyM+fGuQMI39lIQ95OVZHDVYCK wJDYN4UN6tE1i25IPk5CryqmMQu22+TBNsAYMjZF0mhXoHS0cdXXJYOkzcN/xVxkE0 uDdawZuPnJb/D1Ixzb7Kz+zf7fiikzPBv3BoR55k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , "Michael S. Tsirkin" , Jason Wang Subject: [PATCH 5.0 133/137] virtio_ring: Fix potential mem leak in virtqueue_add_indirect_packed Date: Wed, 15 May 2019 12:56:54 +0200 Message-Id: <20190515090703.537212784@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YueHaibing commit df0bfe7501e9319546ea380d39674a4179e059c3 upstream. 'desc' should be freed before leaving from err handing path. Fixes: 1ce9e6055fa0 ("virtio_ring: introduce packed ring support") Signed-off-by: YueHaibing Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/virtio/virtio_ring.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -993,6 +993,7 @@ static int virtqueue_add_indirect_packed if (unlikely(vq->vq.num_free < 1)) { pr_debug("Can't add buf len 1 - avail = 0\n"); + kfree(desc); END_USE(vq); return -ENOSPC; }