Netdev List
 help / color / mirror / Atom feed
* [PATCH net] nfc: nci: free destination parameters when closing a connection
@ 2026-07-21  2:35 Linmao Li
  2026-07-21  9:47 ` Vadim Fedorenko
  0 siblings, 1 reply; 2+ messages in thread
From: Linmao Li @ 2026-07-21  2:35 UTC (permalink / raw)
  To: David Heidelberg, Jakub Kicinski
  Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
	oe-linux-nfc, netdev, linux-kernel, Linmao Li

When a connection is closed, nci_core_conn_close_rsp_packet() frees
conn_info but not conn_info->dest_params, which is a separate devm
allocation. Each connect/close cycle leaks one dest_params until the
NFC device is removed. Free dest_params along with conn_info.

Fixes: 9b8d1a4cf2aa ("nfc: nci: Add an additional parameter to identify a connection id")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
---
 net/nfc/nci/rsp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 6b2fa6bdbd14..21c2fe64490e 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -360,6 +360,7 @@ static void nci_core_conn_close_rsp_packet(struct nci_dev *ndev,
 			list_del(&conn_info->list);
 			if (conn_info == ndev->rf_conn_info)
 				ndev->rf_conn_info = NULL;
+			devm_kfree(&ndev->nfc_dev->dev, conn_info->dest_params);
 			devm_kfree(&ndev->nfc_dev->dev, conn_info);
 		}
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] nfc: nci: free destination parameters when closing a connection
  2026-07-21  2:35 [PATCH net] nfc: nci: free destination parameters when closing a connection Linmao Li
@ 2026-07-21  9:47 ` Vadim Fedorenko
  0 siblings, 0 replies; 2+ messages in thread
From: Vadim Fedorenko @ 2026-07-21  9:47 UTC (permalink / raw)
  To: Linmao Li, David Heidelberg, Jakub Kicinski
  Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
	oe-linux-nfc, netdev, linux-kernel

On 21/07/2026 03:35, Linmao Li wrote:
> When a connection is closed, nci_core_conn_close_rsp_packet() frees
> conn_info but not conn_info->dest_params, which is a separate devm
> allocation. Each connect/close cycle leaks one dest_params until the
> NFC device is removed. Free dest_params along with conn_info.
> 
> Fixes: 9b8d1a4cf2aa ("nfc: nci: Add an additional parameter to identify a connection id")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---
>   net/nfc/nci/rsp.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
> index 6b2fa6bdbd14..21c2fe64490e 100644
> --- a/net/nfc/nci/rsp.c
> +++ b/net/nfc/nci/rsp.c
> @@ -360,6 +360,7 @@ static void nci_core_conn_close_rsp_packet(struct nci_dev *ndev,
>   			list_del(&conn_info->list);
>   			if (conn_info == ndev->rf_conn_info)
>   				ndev->rf_conn_info = NULL;
> +			devm_kfree(&ndev->nfc_dev->dev, conn_info->dest_params);
>   			devm_kfree(&ndev->nfc_dev->dev, conn_info);
>   		}
>   	}

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-21  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21  2:35 [PATCH net] nfc: nci: free destination parameters when closing a connection Linmao Li
2026-07-21  9:47 ` Vadim Fedorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox