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.8 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 2AA96C2D0B1 for ; Thu, 6 Feb 2020 08:36:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E32F720838 for ; Thu, 6 Feb 2020 08:36:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EUiart1Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E32F720838 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 900B06B0007; Thu, 6 Feb 2020 03:36:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B0986B0008; Thu, 6 Feb 2020 03:36:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C66B6B000A; Thu, 6 Feb 2020 03:36:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id 6668F6B0007 for ; Thu, 6 Feb 2020 03:36:51 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 118C18248068 for ; Thu, 6 Feb 2020 08:36:51 +0000 (UTC) X-FDA: 76459046622.27.self89_1ea5980aedb58 X-HE-Tag: self89_1ea5980aedb58 X-Filterd-Recvd-Size: 5916 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Feb 2020 08:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580978209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q97g5nIiWNKIeYjR155QrRPElJ5MgYmnS2baU9/0Vv8=; b=EUiart1YhetlgDTQ/7c59P7YXyiLeMewMdgf49/E9MBeQWMcIYBqRLBteV7pTtQNQ6hji+ 7q1ryKNU25FcFn4Jf0KYmDtB/4PWFg9WfFj/cEL9mKch8wCvlniSwMxlPzmmMVsbfbfH4d rnDiWpum3NikO/P4rr8zQwkzQl0SSJE= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-5VvOXH_YP1GHFMkLLnrkjQ-1; Thu, 06 Feb 2020 03:36:46 -0500 Received: by mail-qv1-f70.google.com with SMTP id ce2so3209246qvb.23 for ; Thu, 06 Feb 2020 00:36:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UeqMGJ0PCFB3EIVnqhK1jSaquiglkcj5+WjsBZdqSko=; b=fIBobi4TUq3XseX6h6j1D+u05jCSBiYQLAYsHXRRZqPoF/DUoznGJcJbvh5wHRvYfw EhgJZADXzbLO6doLZr/NwdLk4VB2JS/vOIsalDV70k/rayViEYJdd2elQv0nQZQNjxXj t2hDvo73IqyRGxSvaVCEaqaQp23SI+z4lxXe87JYK2wzj4HlH+xJ55QxsCGZ9PkQAvdr yLAtDuO6HyVeHXYz9X7O8wfz8We0Exwvwj3mg+D9O2sRZvh4Y1+NjUrGN9iZTZ5egEcL PEKeSSNwmOy3y1Grfv2kPwCLdFNCRUoHL21AT1OLWyOUGN3Ix7Zpn9T6MTB/V4vM+kO7 yyhA== X-Gm-Message-State: APjAAAUBsldXgr/aGTgo2JPiOK0ob4w1vvtAFnjaj/QG51cIUuwKXRx2 a8ZUjAH2iOobon1bCKIQEDDUDsfqE5TDQ1Dvn+u5vlUXm8MiOoIkIhxb6rVhqqlVojd+9Nv2Po/ w54yZW0Y6Y7s= X-Received: by 2002:a05:620a:133a:: with SMTP id p26mr1537143qkj.50.1580978205752; Thu, 06 Feb 2020 00:36:45 -0800 (PST) X-Google-Smtp-Source: APXvYqyCKYXTQb5/Fvn9PbpxsKDUKXGEA9EWCZqxmPKBdJhbBBol0FsQni5dbhdPQ8ikBYhqnUwfBQ== X-Received: by 2002:a05:620a:133a:: with SMTP id p26mr1537132qkj.50.1580978205547; Thu, 06 Feb 2020 00:36:45 -0800 (PST) Received: from redhat.com (bzq-79-176-41-183.red.bezeqint.net. [79.176.41.183]) by smtp.gmail.com with ESMTPSA id h3sm1085355qkk.104.2020.02.06.00.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 00:36:44 -0800 (PST) Date: Thu, 6 Feb 2020 03:36:40 -0500 From: "Michael S. Tsirkin" To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org, Jason Wang , Wei Wang , Liang Li Subject: Re: [PATCH v1 2/3] virtio_balloon: Fix memory leaks on errors in virtballoon_probe() Message-ID: <20200206033633-mutt-send-email-mst@kernel.org> References: <20200205163402.42627-1-david@redhat.com> <20200205163402.42627-3-david@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200205163402.42627-3-david@redhat.com> X-MC-Unique: 5VvOXH_YP1GHFMkLLnrkjQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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: On Wed, Feb 05, 2020 at 05:34:01PM +0100, David Hildenbrand wrote: > We forget to put the inode and unmount the kernfs used for compaction. >=20 > 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 Applied, thanks! > --- > drivers/virtio/virtio_balloon.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) >=20 > 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) > =09vb->vb_dev_info.inode =3D alloc_anon_inode(balloon_mnt->mnt_sb); > =09if (IS_ERR(vb->vb_dev_info.inode)) { > =09=09err =3D PTR_ERR(vb->vb_dev_info.inode); > -=09=09kern_unmount(balloon_mnt); > -=09=09goto out_del_vqs; > +=09=09goto out_kern_unmount; > =09} > =09vb->vb_dev_info.inode->i_mapping->a_ops =3D &balloon_aops; > #endif > @@ -913,13 +912,13 @@ static int virtballoon_probe(struct virtio_device *= vdev) > =09=09 */ > =09=09if (virtqueue_get_vring_size(vb->free_page_vq) < 2) { > =09=09=09err =3D -ENOSPC; > -=09=09=09goto out_del_vqs; > +=09=09=09goto out_iput; > =09=09} > =09=09vb->balloon_wq =3D alloc_workqueue("balloon-wq", > =09=09=09=09=09WQ_FREEZABLE | WQ_CPU_INTENSIVE, 0); > =09=09if (!vb->balloon_wq) { > =09=09=09err =3D -ENOMEM; > -=09=09=09goto out_del_vqs; > +=09=09=09goto out_iput; > =09=09} > =09=09INIT_WORK(&vb->report_free_page_work, report_free_page_func); > =09=09vb->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: > =09if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) > =09=09destroy_workqueue(vb->balloon_wq); > +out_iput: > +#ifdef CONFIG_BALLOON_COMPACTION > +=09iput(vb->vb_dev_info.inode); > +out_kern_unmount: > +=09kern_unmount(balloon_mnt); > +#endif > out_del_vqs: > =09vdev->config->del_vqs(vdev); > out_free_vb: > --=20 > 2.24.1