Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3271512pxb; Wed, 13 Oct 2021 02:36:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgxi9E2+lbttS6AEppssrAZE/Zudgm4DfqRj6WkUYgGQWiYR5drGSyTp3KZ7+JNHFU19Dr X-Received: by 2002:a62:7b90:0:b0:44d:fa6:325 with SMTP id w138-20020a627b90000000b0044d0fa60325mr18355620pfc.1.1634117781676; Wed, 13 Oct 2021 02:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634117781; cv=none; d=google.com; s=arc-20160816; b=asGc+s5hYK+0u7GV96af0C09xHm7NNMHWmQ0LAh3BErcfq8okkLCv17rqrLA/qc/nl LqvFYUtz6FG/1AmU0zdd3yNqWYC2xMTt3M3IgjGliJMBCQGDDhmzqvDfSNdv55jZi2DK GWo8mVcXK5wuzindBqnwV2e/Sg7uuNlWCeL+phxmqu015mU/txfFmYsYAWadqWzyu3a0 0pqKfKkjFgCQIQ26Rq8hEgiYOMYyHHonibQdCzPvgxLq0mFAEHdyPkCZDPowxqJnLUHn 6nfh7huLEQOx3+U8wIg8KJmWSZnlcJsA5KZkqljef3jGfkwySnrW404+0/MefIwZ9SNU d5MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=IKEbfKOXTTA9Zy1G5D27Bz2whSJ8iNQQGtVLWBGoxFI=; b=MGH18NgasF1K8J/eBtfhpbfKBlxYXaWz/3PwvWsSoaouZtLipEnDXpQfhcG/gH1r9F kK465ZnarR3ZIlwtWupaOGmwklNuSi80Qg/hSx/ddr9BYt0ZeiUpw59Ch2GjaM2cQrax /ZgFoR2kv8UC1e0q72Z7cHPjdr55NEidQTIroGQCYvwOuegMYjxBNKalOljTkH6nZzI8 CIShREfEl2pZOw3lCLEhCTglK9D0D5WLLgLv0tJEIjuAwl0/UobhM8B+OzdVCRfmIcKj P227ST1bOUCg/zF3CyacF9voMksD98HgJHA9scOQrCBJ+Ojce1LgCLjfbMfclPOEmCP4 V05A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=srlQazY9; 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=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si20999800pgu.293.2021.10.13.02.36.08; Wed, 13 Oct 2021 02:36:21 -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=@canonical.com header.s=20210705 header.b=srlQazY9; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235642AbhJMJhM (ORCPT + 99 others); Wed, 13 Oct 2021 05:37:12 -0400 Received: from smtp-relay-internal-0.canonical.com ([185.125.188.122]:56134 "EHLO smtp-relay-internal-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235811AbhJMJhL (ORCPT ); Wed, 13 Oct 2021 05:37:11 -0400 Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B7DC340016 for ; Wed, 13 Oct 2021 09:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1634117707; bh=IKEbfKOXTTA9Zy1G5D27Bz2whSJ8iNQQGtVLWBGoxFI=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=srlQazY9SaPy3EQSJ/UVskbbwxDcC8R1tV5RPvHgA1lncACtVhohC98OZPjnG6j0g 6HBeDT0ljbINHICBQuvq7X9XgX24J9MuCrEyndRSgcVuinNOUaLJjreMaTVmB3HYDY e+NYEqE2pQfRhVHWdaCUuq/udI7Cc50+Y5H7qryk1aonGSgTT9n3NBaZJsxOk6rwCc tzvWnUyA72d6ikA3FF2s5XdtCMLlOxjbg3HB2MGTA8OIX1enyaFiFZ0hv7Vg1BQ9Zw 3RWiH9og8ujGYYTx/Lkcne6GurLziwm1LpM9Dsypnw5/JgzIzl2mlX0XkJ6VytLNdz lUGNM8e23iBpg== Received: by mail-lf1-f70.google.com with SMTP id g10-20020a05651222ca00b003fda3f05c17so1545047lfu.11 for ; Wed, 13 Oct 2021 02:35:07 -0700 (PDT) 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=IKEbfKOXTTA9Zy1G5D27Bz2whSJ8iNQQGtVLWBGoxFI=; b=Lxx6Mh/HKN6WUeT56dAxm+zSFLDcgn4sU5lzZlEk0m8AGpzdX/1Fm4F4arRg7EWAIb YQ0Zw7bs+W9iLslQnhU2d++OPAP9/c/P1sR0ujV/rckqzgM8rWdwHfvrZUKVKDcobo3b W8NQ/ZDS/6B+1Mx0PFOAPxMNtpRv/IWnMCmx+ov4hqMZDJhnYseODIC09KzbyUV4BzzH qim1ClrM2jb86lixWGW8gWGUg8wptmZBt6wypNgCbcQfCuFj8KhGu8L4j6/nBCW7QdV6 c0eNW0adhFDP+iwRLOJNrLVgvXdyNSHn5WyzoXXQ34/oQdU8YmM8pV1ICsxSW741XLKx LVVg== X-Gm-Message-State: AOAM531y2l29XU8YEwaiAVwhcJHmRGaaWX4ZYFvjlxi1k9bJ//NWPFu1 Fiyer3kHp1reLOS1Z5lo3+cFFAiNhKoJSK5mJeIZuibOjiWvfK7UyK3nEvya0R33q4SN0Vf7L/y K27kCdT+Sg22U+sIXOlonzZpRG3mGF+V3ld64sGcxvw== X-Received: by 2002:a2e:6e0b:: with SMTP id j11mr35072129ljc.527.1634117706786; Wed, 13 Oct 2021 02:35:06 -0700 (PDT) X-Received: by 2002:a2e:6e0b:: with SMTP id j11mr35072107ljc.527.1634117706543; Wed, 13 Oct 2021 02:35:06 -0700 (PDT) Received: from [192.168.0.22] (89-77-68-124.dynamic.chello.pl. [89.77.68.124]) by smtp.gmail.com with ESMTPSA id t3sm1413241ljd.41.2021.10.13.02.35.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Oct 2021 02:35:05 -0700 (PDT) Subject: Re: [PATCH net 1/2] NFC: digital: fix possible memory leak in digital_tg_listen_mdaa() To: Ziyang Xuan Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <4e3578352a4548feb1d3087c7ec38fedab18292d.1634111083.git.william.xuanziyang@huawei.com> From: Krzysztof Kozlowski Message-ID: <1013af1d-51f7-9798-e2aa-15c03d269ac1@canonical.com> Date: Wed, 13 Oct 2021 11:35:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <4e3578352a4548feb1d3087c7ec38fedab18292d.1634111083.git.william.xuanziyang@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/10/2021 09:50, Ziyang Xuan wrote: > 'params' is allocated in digital_tg_listen_mdaa(), but not free when > digital_send_cmd() failed, which will cause memory leak. Fix it by > freeing 'params' if digital_send_cmd() return failed. > > Fixes: 1c7a4c24fbfd ("NFC Digital: Add target NFC-DEP support") > Signed-off-by: Ziyang Xuan > --- > net/nfc/digital_core.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > Good catch. Leak is only theoretical as digital_send_cmd() will fail only on memory allocation failure but your fix makes code correct. Reviewed-by: Krzysztof Kozlowski Best regards, Krzysztof