All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Fedor Pchelkin <pchelkin@ispras.ru>, Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexey Khoroshilov <khoroshilov@ispras.ru>,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] nfc: change order inside nfc_se_io error path
Date: Mon, 6 Mar 2023 16:28:12 +0100	[thread overview]
Message-ID: <7370a80b-56f9-a858-ff05-5ba9d7206c8c@linaro.org> (raw)
In-Reply-To: <20230304164844.133931-1-pchelkin@ispras.ru>

On 04/03/2023 17:48, Fedor Pchelkin wrote:
> cb_context should be freed on error paths in nfc_se_io as stated by commit
> 25ff6f8a5a3b ("nfc: fix memory leak of se_io context in nfc_genl_se_io").
> 
> Make the error path in nfc_se_io unwind everything in reverse order, i.e.
> free the cb_context after unlocking the device.
> 
> No functional changes intended - only adjusting to good coding practice.

I would argue that it is functional. Running code in or outside of
critical section/locks is quite functional change.

> 
> Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> ---
>  net/nfc/netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
> index 348bf561bc9f..b9264e730fd9 100644
> --- a/net/nfc/netlink.c
> +++ b/net/nfc/netlink.c
> @@ -1446,8 +1446,8 @@ static int nfc_se_io(struct nfc_dev *dev, u32 se_idx,
>  	return rc;
>  
>  error:
> -	kfree(cb_context);
>  	device_unlock(&dev->dev);
> +	kfree(cb_context);


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

>  

Best regards,
Krzysztof


  reply	other threads:[~2023-03-06 15:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04 16:48 [PATCH] nfc: change order inside nfc_se_io error path Fedor Pchelkin
2023-03-06 15:28 ` Krzysztof Kozlowski [this message]
2023-03-06 20:35   ` Fedor Pchelkin
2023-03-06 20:41     ` Fedor Pchelkin
2023-03-06 20:58       ` Jakub Kicinski
2023-03-06 21:26         ` [PATCH v2] " Fedor Pchelkin
2023-03-07  9:19           ` Krzysztof Kozlowski
2023-03-07 21:50           ` 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=7370a80b-56f9-a858-ff05-5ba9d7206c8c@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=khoroshilov@ispras.ru \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pchelkin@ispras.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.