Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp827600pxb; Tue, 8 Feb 2022 03:29:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2dP9XUYt1NA2YSWmLVPzrxaA/spc9ZOUeRK8iLnQsvBM4V5UbqJ6WEfAri8iJx77Pzt6U X-Received: by 2002:a17:907:9495:: with SMTP id dm21mr3333273ejc.87.1644319778106; Tue, 08 Feb 2022 03:29:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644319778; cv=none; d=google.com; s=arc-20160816; b=bvEZxqkPZGRnkl+6hcOdFpblLWVmANJ+1RjiwfJIaYZyvi+liJk3vXQP2003l91FrR /cVAe2oIMk/V6TgbT3Mq39lWum167NIC1WSJAw0cqMOF2UmSRJbfP8np6Qkm5kPMhk2x 1n/BhF28fHI7t8Xoq1eTCogSI6/F6QtbnzT7aO0EJ4YzBFv7K5ITWhCD+phWDNygtuxW FVVm+ztSeFWEeIONiRRMgEKCFXZldsbXwb/tlDe1LQd+Q08ykljCQNp71Nq7xS2dHjvt blkmV2VSmmg7ia4tiDMrgtdFIaKNuauXt6HbbqyXMZrz5mxKw38FnGsrdWpqDF9APMl4 OWSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MgMZtoimtxO2XWZhw1+iy1PmNLRHGLJ65lgwWFNnd+Q=; b=aiFgwYWpD7yZmjscgz8KvEjsoPGExIbPdBjsIseRH3DXzFDelRGFauEjk/rss5lcEV RICpVFqezKA+AyQe+/e7s/FauBOpVT7V7tpBfjS+RGAeP2AZcUwCFyswvzHQJIx95k0t oFfecX+gBQdtj11Y+PY/zuyaRGeGc3pwyz1bmJRV0DmLqe6gcYlvTAFLJI4BXUQEEvpC P1RMIX4/wrkGP2eDX08QS1tZX1WJdRu/Y7gnWm6eBdkygnXZi+dhbY7mChd3Fldbzfyy 4TsvflG+F2FmCQ9cYpCBgcKm7G05FA4nx1/92duUGCS6UTfSknsMyDiScai7P7nKAY3f 8TEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2si9479300edi.143.2022.02.08.03.29.13; Tue, 08 Feb 2022 03:29:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344431AbiBGSBa (ORCPT + 99 others); Mon, 7 Feb 2022 13:01:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345626AbiBGRzA (ORCPT ); Mon, 7 Feb 2022 12:55:00 -0500 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E8DC0401DC; Mon, 7 Feb 2022 09:54:59 -0800 (PST) Received: by mail-wr1-f53.google.com with SMTP id u23so2481469wru.6; Mon, 07 Feb 2022 09:54:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=MgMZtoimtxO2XWZhw1+iy1PmNLRHGLJ65lgwWFNnd+Q=; b=4VzzEql7S1l92TGmwkbuxjVszJXPRFD0c4UnMj+53UNOqntXrn8KmKDW9OXsuAq6vP ijgEFJy0FWuNXd84GGbyZOCA8F+T7FJw+JnVs/psuW7bB4akAoed/rqNf9Qnt/MASj3+ TYpEWFa406O9PMhrgsglET701bqWphm3BKqIORO5u4/yHWLFCad8GwCnMToQrtR2439C NHTty2mOeVEUssntGWW4v09+lDAY87IFSTlgREjkrF2L0zWrSh4ceIVQh7fAx4yjgy/W mFfcqLBqTD/vp4Alq+wJ5Xdpo2XSVE2ID9rjpkxHYzS/9pTpd+CE/mQeFbuitRVbB/gW Wk5w== X-Gm-Message-State: AOAM530OvbysyFWKRPnZT8JdxsJ8zc0MVspl7fNlsIY/4QzdETczQs07 dQAMoEeLvVxeDQ+pUlTC4YY= X-Received: by 2002:adf:8010:: with SMTP id 16mr450436wrk.708.1644256497887; Mon, 07 Feb 2022 09:54:57 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id f13sm13358wmq.29.2022.02.07.09.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 09:54:57 -0800 (PST) Date: Mon, 7 Feb 2022 17:54:55 +0000 From: Wei Liu To: Juan Vazquez Cc: Miaoqian Lin , decui@microsoft.com, gregkh@linuxfoundation.org, haiyangz@microsoft.com, kys@microsoft.com, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, sthemmin@microsoft.com, wei.liu@kernel.org Subject: Re: [PATCH v2] Drivers: hv: vmbus: Fix memory leak in vmbus_add_channel_kobj Message-ID: <20220207175455.ftlpbzzuq5wqducc@liuwe-devbox-debian-v2> References: <20220128215604.xuqdpnnn4yjqfaoy@surface> <20220203173008.43480-1-linmq006@gmail.com> <20220206145556.72obb2qxbsktw3sc@surface> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220206145556.72obb2qxbsktw3sc@surface> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 06, 2022 at 06:55:56AM -0800, Juan Vazquez wrote: > On Fri, Feb 04, 2022 at 01:30:08AM +0800, Miaoqian Lin wrote: > > kobject_init_and_add() takes reference even when it fails. > > According to the doc of kobject_init_and_add(): > > > > If this function returns an error, kobject_put() must be called to > > properly clean up the memory associated with the object. > > > > Fix memory leak by calling kobject_put(). > > > > Fixes: c2e5df616e1a ("vmbus: add per-channel sysfs info") > > Signed-off-by: Miaoqian Lin > > --- > > Changes in v2: > > - Add cleanup when sysfs_create_group() fails > > > > kobject_uevent() is used for notifying userspace by sending an uevent, > > I don't think we need to do error handling for it. > > Thanks for the patch. It looks good to me. > > Reviewed-by: Juan Vazquez Applied to hyperv-fixes. Thanks.