Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp200007ybm; Thu, 28 May 2020 00:05:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHiTn5Ls0u2MXOfyy1ysROWMN0X/uGpOITLKbJvKVf4GRa/9BDrL1RzeI28Kg+Y1yw8mzK X-Received: by 2002:a17:906:e0c:: with SMTP id l12mr1610418eji.435.1590649507122; Thu, 28 May 2020 00:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590649507; cv=none; d=google.com; s=arc-20160816; b=HCLs57ytqQ4gITomXReHw4BTNgDZrcmYCQeOwq0G4JFyoe5P+vLmOzb4ahHNfs/n/s WUz0GEik6NoKwbvoPOphOL6ozEZr0UTtPALj66ovbgFOA9upj7YPujud+QQ3EY81dIaH hf/xj77+puD/EaCdgnv1YVIipQ2Mv6IUIleND6ZkhRkJog24tBbUxa1nA9Pny3uTvObS lsqwppJDRwvRMMG+1jkErNXW2E0Q4hh/CepK++G7QQL7feCP1pacJydTxCIJM8D9RWoo mxfILNVQEAC2NeOYbqZaZa5YQ0T+kpbXsgquZo2wMJ7vseS3UE3cAjLeI0g2WesiuA9T +olw== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=qDDJ9W9XOpuhYXls0f2pXAJfIi1uNmOqH7E8hW7QAjk=; b=YiOdwP86Qr8/wzEQf3QvHxBeJlhfU9LNSCwvBO92jeGBlZmDRLOq4NO3QM2Hi2+Rf/ euvTjBS1y/3Htnn/9sUyzG65tJqD94n8BUS8siJPj6WHrcO7cDfrSVmTJCn2zbYyn52B mi8blpLfEQ5D/gj2jFb9vDoUrXRcwxKZ5+kABxYBM90HrPLOSOB5ZLRZT9qoBkjmRCKF jYncJbeNCf22jVgsFx2DAUxnGJpK3slIrAinLk0L0HUpSvbaiPDPS5yrNpTbUoCZB1MG QsQFWXXFNhFLqeTTYY7Cm2B2D/mtrjgTUT3330ab5ACCCTW6p59yYCGAn1EF36ZJRbFZ RXzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Aod433Qm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fy2si3632797ejb.11.2020.05.28.00.04.44; Thu, 28 May 2020 00:05:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Aod433Qm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726195AbgE1HCe (ORCPT + 99 others); Thu, 28 May 2020 03:02:34 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:59224 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725834AbgE1HCe (ORCPT ); Thu, 28 May 2020 03:02:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590649353; 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=qDDJ9W9XOpuhYXls0f2pXAJfIi1uNmOqH7E8hW7QAjk=; b=Aod433Qm8KlOsvtP3yJ4vFWhMJhkDQyspwd6QJJOykpMNoWNIKPVfragL+RMM3BfesXZiQ WUnr9ZQoewnKK031i4C4+MTPPSWPNlhE5DyIpb3xzMI60stBXYpKXGBUz0DbmXXcfhbLC4 nQasb//eK5unlBYRu4Mm11RKdaWX64g= 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-295-4q13vZZgMnGlG_c-AMWSEA-1; Thu, 28 May 2020 03:02:29 -0400 X-MC-Unique: 4q13vZZgMnGlG_c-AMWSEA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31651872FE0; Thu, 28 May 2020 07:02:28 +0000 (UTC) Received: from gondolin (ovpn-113-28.ams2.redhat.com [10.36.113.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC0065C1B0; Thu, 28 May 2020 07:02:22 +0000 (UTC) Date: Thu, 28 May 2020 09:02:20 +0200 From: Cornelia Huck To: wu000273@umn.edu Cc: kjlu@umn.edu, Kirti Wankhede , Alex Williamson , Neo Jia , Dong Jia Shi , Jike Song , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] vfio/mdev: Fix reference count leak in add_mdev_supported_type. Message-ID: <20200528090220.6dc94bd7.cohuck@redhat.com> In-Reply-To: <20200528020109.31664-1-wu000273@umn.edu> References: <20200528020109.31664-1-wu000273@umn.edu> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 27 May 2020 21:01:09 -0500 wu000273@umn.edu wrote: > From: Qiushi Wu > > kobject_init_and_add() takes reference even when it fails. > If this function returns an error, kobject_put() must be called to > properly clean up the memory associated with the object. Thus, > replace kfree() by kobject_put() to fix this issue. Previous > commit "b8eb718348b8" fixed a similar problem. > > Fixes: 7b96953bc640 ("vfio: Mediated device Core driver") > Signed-off-by: Qiushi Wu > --- > drivers/vfio/mdev/mdev_sysfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Cornelia Huck