linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Ziyang Xuan <william.xuanziyang@huawei.com>
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/2] NFC: digital: fix possible memory leak in digital_tg_listen_mdaa()
Date: Wed, 13 Oct 2021 11:35:03 +0200	[thread overview]
Message-ID: <1013af1d-51f7-9798-e2aa-15c03d269ac1@canonical.com> (raw)
In-Reply-To: <4e3578352a4548feb1d3087c7ec38fedab18292d.1634111083.git.william.xuanziyang@huawei.com>

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 <william.xuanziyang@huawei.com>
> ---
>  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 <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof

  reply	other threads:[~2021-10-13  9:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13  7:49 [PATCH net 0/2] fix two possible memory leak problems in NFC digital module Ziyang Xuan
2021-10-13  7:50 ` [PATCH net 1/2] NFC: digital: fix possible memory leak in digital_tg_listen_mdaa() Ziyang Xuan
2021-10-13  9:35   ` Krzysztof Kozlowski [this message]
2021-10-13  7:50 ` [PATCH net 2/2] NFC: digital: fix possible memory leak in digital_in_send_sdd_req() Ziyang Xuan
2021-10-13  9:36   ` Krzysztof Kozlowski
2021-10-14  0:50 ` [PATCH net 0/2] fix two possible memory leak problems in NFC digital module patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1013af1d-51f7-9798-e2aa-15c03d269ac1@canonical.com \
    --to=krzysztof.kozlowski@canonical.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=william.xuanziyang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).