From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58A7EC35247 for ; Wed, 5 Feb 2020 16:34:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1841921741 for ; Wed, 5 Feb 2020 16:34:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="glMUQ8wR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1841921741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BCFBA6B0006; Wed, 5 Feb 2020 11:34:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B80D86B0007; Wed, 5 Feb 2020 11:34:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A95D66B0008; Wed, 5 Feb 2020 11:34:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0178.hostedemail.com [216.40.44.178]) by kanga.kvack.org (Postfix) with ESMTP id 8FE996B0006 for ; Wed, 5 Feb 2020 11:34:22 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2B2E98248047 for ; Wed, 5 Feb 2020 16:34:22 +0000 (UTC) X-FDA: 76456621164.01.anger89_433541e5e7d3f X-HE-Tag: anger89_433541e5e7d3f X-Filterd-Recvd-Size: 4264 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 5 Feb 2020 16:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580920461; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UcRyPB3D16FS1hVzLFRfsL6mac9y5ECi0rwpQjWwHMc=; b=glMUQ8wRYstOwtkmh9gjNAAGRhE0s7JSIXCq+xEJcPm96Wk25rGa8PwpO6acfWnrB4k3dW PDZ35ZnMI5H0mLVt77OYeAt4O6/NnHN5vWXQVGAAswpeY0/fcNzw7wFRCnY4kB7Hfl0LDL 0llhwz2yMg/xC7lCCSHUNB2uNHPnNds= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-vcLuwmAEPOubLDhojSHGcg-1; Wed, 05 Feb 2020 11:34:16 -0500 X-MC-Unique: vcLuwmAEPOubLDhojSHGcg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 706BA8018B7; Wed, 5 Feb 2020 16:34:15 +0000 (UTC) Received: from t480s.redhat.com (ovpn-116-217.ams2.redhat.com [10.36.116.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA5D91001B08; Wed, 5 Feb 2020 16:34:13 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, virtualization@lists.linux-foundation.org, David Hildenbrand , "Michael S. Tsirkin" , Jason Wang , Wei Wang , Liang Li Subject: [PATCH v1 2/3] virtio_balloon: Fix memory leaks on errors in virtballoon_probe() Date: Wed, 5 Feb 2020 17:34:01 +0100 Message-Id: <20200205163402.42627-3-david@redhat.com> In-Reply-To: <20200205163402.42627-1-david@redhat.com> References: <20200205163402.42627-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We forget to put the inode and unmount the kernfs used for compaction. Fixes: 71994620bb25 ("virtio_balloon: replace oom notifier with shrinker"= ) Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Wei Wang Cc: Liang Li Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_balloon.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_ball= oon.c index abef2306c899..7e5d84caeb94 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -901,8 +901,7 @@ static int virtballoon_probe(struct virtio_device *vd= ev) vb->vb_dev_info.inode =3D alloc_anon_inode(balloon_mnt->mnt_sb); if (IS_ERR(vb->vb_dev_info.inode)) { err =3D PTR_ERR(vb->vb_dev_info.inode); - kern_unmount(balloon_mnt); - goto out_del_vqs; + goto out_kern_unmount; } vb->vb_dev_info.inode->i_mapping->a_ops =3D &balloon_aops; #endif @@ -913,13 +912,13 @@ static int virtballoon_probe(struct virtio_device *= vdev) */ if (virtqueue_get_vring_size(vb->free_page_vq) < 2) { err =3D -ENOSPC; - goto out_del_vqs; + goto out_iput; } vb->balloon_wq =3D alloc_workqueue("balloon-wq", WQ_FREEZABLE | WQ_CPU_INTENSIVE, 0); if (!vb->balloon_wq) { err =3D -ENOMEM; - goto out_del_vqs; + goto out_iput; } INIT_WORK(&vb->report_free_page_work, report_free_page_func); vb->cmd_id_received_cache =3D VIRTIO_BALLOON_CMD_ID_STOP; @@ -953,6 +952,12 @@ static int virtballoon_probe(struct virtio_device *v= dev) out_del_balloon_wq: if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) destroy_workqueue(vb->balloon_wq); +out_iput: +#ifdef CONFIG_BALLOON_COMPACTION + iput(vb->vb_dev_info.inode); +out_kern_unmount: + kern_unmount(balloon_mnt); +#endif out_del_vqs: vdev->config->del_vqs(vdev); out_free_vb: --=20 2.24.1