Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp296112ybm; Thu, 28 May 2020 23:53:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0fpMr8pbQjHzKpYXHKemM9vcSD26qn6A3FOam/2x2fNknFUJGuAOfyjDwKfmXFQFnTqxV X-Received: by 2002:a17:906:da1e:: with SMTP id fi30mr6591965ejb.80.1590735230249; Thu, 28 May 2020 23:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590735230; cv=none; d=google.com; s=arc-20160816; b=Tk/CToFpL4g4DS3u4t7udMRBJJOmokKUh3ydwO+ryGh4qbBkFTPatAMIp2CqBelLg0 OAMoqAduBj54ff59aOiKsn/LuQmg2vYqGsMtxhH27YHrC+/bpqNxlroja1Wmrjb0IjdC YLJg5ZvSZFAND1CBWz1p2rnS8gvRijRhH/xMmoD3SZEREPcuxF+N9d0wLmKzAwyK0SeI DZe8oSi5choK0PbVEa1PoHcyNIxuQz8FoNF/oQj1F4fBqYSfmB2c07AJ4X5Q3euo/xRJ mo50s9hzkWxu6rnP/fH7nLLoB+8ly3vgsPTyoQfT38Tq6FvCMkE41nATnYVQ/iIpxiON //2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=3MdeqVyB7qqljYQy1e+2+zaRWsAJCR017mMr9VXzZ4Y=; b=cFtI3h+YIrBG7vExhkhM5no7PQP6Q4r32A+Z5uDatXbKO2LCdbdRrpKQQaYKeqDrS9 vv1Y9flllrg8+19AvTM2H8QJKcesrctCuVIikR8anVD14Su8SMepQiCpTyH93rSXitM9 RTkLQaiej7Hsh9Xo5Lvb0vgFfthUVaxqIYxt+SVfDW9uiX8TUo46Zur83hwd4hPaAOi8 lBEbnm1492bavufVffsUA3U2ydUyvkCxCWM4BV1ud1p1eI0Atz6kh8/3BMuMG8d+gMiM EoCML8Wvc9mh0YAFkrtIpSJ1MoDAoEX+8XG8ETAZQYqf7x+2kjMDA+gidKXfM8HXvRp5 aC3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=G3Q6Iq9g; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cd26si5138389ejb.136.2020.05.28.23.53.27; Thu, 28 May 2020 23:53:50 -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=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=G3Q6Iq9g; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725906AbgE2Gta (ORCPT + 99 others); Fri, 29 May 2020 02:49:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725562AbgE2Gt3 (ORCPT ); Fri, 29 May 2020 02:49:29 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CD68C08C5C6 for ; Thu, 28 May 2020 23:49:29 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id a2so967385ejb.10 for ; Thu, 28 May 2020 23:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=3MdeqVyB7qqljYQy1e+2+zaRWsAJCR017mMr9VXzZ4Y=; b=G3Q6Iq9gGZmpk3gidKEg293iTpRBe03usgIvHj/o9dYqlqSG2a2o4i/vuUH7o39HZz JbdjNQE1oDQp48dIw7wnU50wo0HT0NKGFSt0TGg/8B5IveZL9DPStnl0r+Xdog7qU9jR JDEWI+nf7Yn3KBqZY9jPM26baohAPXo3S9ofUNsFYpzEbHwdN3GymLvNCrYtj0dJWPwq BYAJzAhNsORPoyCBEt9U8tnLJRSD5UzHVbY7ts/3vbWk/ae6W1DaCCmOu366sQewdSP+ erERilRbZYTrjNCWlFek0u/X/9WCByrGA2NVsC8+5UCd4aJF0pMx+dBM4FMLfpFeWcYN qZyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=3MdeqVyB7qqljYQy1e+2+zaRWsAJCR017mMr9VXzZ4Y=; b=foeCKDlPZjSKISI6zw93XK+hq7FmR6tdEtN7mxIFMvr/PvKY/uu9k6tRd6Fcf9bdyf R81ejoMDBY+WqyR+Ta+N1kmuhSWNjhB18XNb9hSRVc14kcm/Dm6nHGSNexdu03x0n2Tv PA3wBixfztwFyk5Bx1VUkQlhtnyif0JdZXEAVUYKHchjMr+ja979vTDaNSWJkBwnyxmY G5lsVysCrfUjKdAvYfWObgdU7eZcjAqlmOOaEXnr9166Uiy62z1xhpzxj+PS1+y9LswD xFEufMwBab3B4daW3xtlu34cdfrGEicSBjQgKKCMjoYAYBlOI9EUyT0HYIMmv6C4yZDo gU4g== X-Gm-Message-State: AOAM533KfZdHmyZCR8usAQUv816qfluOGhKpBfoWfD7hjoUSgTlTs1KV EjH/W2QWZsJLSqDppMmxFR6jlgalzcc= X-Received: by 2002:a17:906:7f84:: with SMTP id f4mr6117632ejr.482.1590734968104; Thu, 28 May 2020 23:49:28 -0700 (PDT) Received: from [10.0.0.6] (xb932c246.cust.hiper.dk. [185.50.194.70]) by smtp.gmail.com with ESMTPSA id bd10sm5966118edb.10.2020.05.28.23.49.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2020 23:49:27 -0700 (PDT) Subject: Re: [PATCH] lightnvm: pblk: Fix reference count leak in pblk_sysfs_init. To: wu000273@umn.edu, kjlu@umn.edu Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200527210628.9477-1-wu000273@umn.edu> From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: Date: Fri, 29 May 2020 08:49:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20200527210628.9477-1-wu000273@umn.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/05/2020 23.06, wu000273@umn.edu wrote: > From: Qiushi Wu > > kobject_init_and_add() takes reference even when it fails. > Thus, when kobject_init_and_add() returns an error, > kobject_put() must be called to properly clean up the kobject. > > Fixes: a4bd217b4326 ("lightnvm: physical block device (pblk) target") > Signed-off-by: Qiushi Wu > --- > drivers/lightnvm/pblk-sysfs.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/lightnvm/pblk-sysfs.c b/drivers/lightnvm/pblk-sysfs.c > index 6387302b03f2..90f1433b19a2 100644 > --- a/drivers/lightnvm/pblk-sysfs.c > +++ b/drivers/lightnvm/pblk-sysfs.c > @@ -711,6 +711,7 @@ int pblk_sysfs_init(struct gendisk *tdisk) > "%s", "pblk"); > if (ret) { > pblk_err(pblk, "could not register\n"); > + kobject_put(&pblk->kobj); > return ret; > } > Thanks, Quishi. Signed-off-by: Matias Bjørling Jens, would you kindly pick up the patch? Thank you, Matias