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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA9BDC4332F for ; Fri, 1 Oct 2021 19:59:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF77161AE4 for ; Fri, 1 Oct 2021 19:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353785AbhJAUBF (ORCPT ); Fri, 1 Oct 2021 16:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242085AbhJAUBE (ORCPT ); Fri, 1 Oct 2021 16:01:04 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8242FC061775 for ; Fri, 1 Oct 2021 12:59:19 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id d18so12955502iof.13 for ; Fri, 01 Oct 2021 12:59:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pDTsW1n9PK29PC83itCom+RuJCbJXbDX2PBAwxtEi5Q=; b=Ml99nyYTXl1us4C9eU4XDofXWruq6cG2KGnk9dBR0BrGt6e9VpgeS9aQ5dGZaNTLWa gq89Rn4zH9/iiMwTTtcuhkBn4FnGHAWSCFXQrwPFb7ygn1Cl6uLRfzmGcA6KN3JjIKTM ZldSrFlNMxq9AJf2SMJl3OQAOWl7m9tPSFXQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pDTsW1n9PK29PC83itCom+RuJCbJXbDX2PBAwxtEi5Q=; b=sUtswSMSArd4mkK+kI72yI3vtn85f3nm+aHKA23eNl17Y/QUxbsxcupaPa/PlXwbvo S2ghD1StZ/0uE4BaBm+W53dc7FJZEqhW3b+qhlQBrQ+v/3DQC49e/dSoExTnIKzbcg8d PS4aYQnvvu201hjCCBmCr0vpX2A0AX6Slh8WQmXUVBhAxB5bzG5ZcxNp6Sb38/rW6xHP tlI8Z7a0VvlcJCTc2p/Iu1hFVpkETGFf085xaGLcpFXCCbQi9RwX5jM9fHV/1S5mtLCu mCHznBkiMMo8cN7lhEMMm1mI5SXuKKES0S+DNSpZ4/x+i1hUdXt2dL6k4ATyDFO6T1na cjbA== X-Gm-Message-State: AOAM5308k+mVgPiNmsJ0+PR7253KAcIu4PAwFoZNurf+Wd5Do1GWZSSN V0Yr1ZN+zxPsG7Zgk3Di5R3XPz3YXNYzYQ== X-Google-Smtp-Source: ABdhPJz7WObTRwrNwsUIUmOaCxXC6fSE3ENtuiDAss6zrGtbO8V3lFAqhwaVSA/N9RO0GGFulz0KNQ== X-Received: by 2002:a02:23c3:: with SMTP id u186mr4578264jau.34.1633118358965; Fri, 01 Oct 2021 12:59:18 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id f20sm4000141ile.57.2021.10.01.12.59.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Oct 2021 12:59:18 -0700 (PDT) Subject: Re: [PATCH v2] kunit: fix reference count leak in kfree_at_end To: Xiyu Yang Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, yuanxzhang@fudan.edu.cn, Xin Tan , Brendan Higgins , Shuah Khan References: <1631172276-82914-1-git-send-email-xiyuyang19@fudan.edu.cn> From: Shuah Khan Message-ID: Date: Fri, 1 Oct 2021 13:59:17 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/28/21 3:27 PM, Brendan Higgins wrote: > On Thu, Sep 9, 2021 at 12:26 AM Xiyu Yang wrote: >> >> The reference counting issue happens in the normal path of >> kfree_at_end(). When kunit_alloc_and_get_resource() is invoked, the >> function forgets to handle the returned resource object, whose refcount >> increased inside, causing a refcount leak. >> >> Fix this issue by calling kunit_alloc_resource() instead of >> kunit_alloc_and_get_resource(). >> >> Signed-off-by: Xiyu Yang >> Signed-off-by: Xin Tan > > Reviewed-by: Brendan Higgins > > Thanks! > Thank you for the fix. Applied now after fixing a checkpatch alignment check to git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/ kunit-fixes branch. Please remember to run checkpatch.pl before sending patches. thanks, -- Shuah