The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 net-next] sctp: use sctp_auth_shkey_release() in error path for consistency
@ 2026-06-22 10:02 Wentao Liang
  2026-06-25  2:01 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-06-22 10:02 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner, Xin Long, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, linux-sctp, netdev, linux-kernel, Wentao Liang

Use the proper refcount-aware helper sctp_auth_shkey_release() instead
of kfree() when freeing cur_key in the error path of sctp_auth_set_key().
While both are equivalent in the current code, using the helper maintains
abstraction consistency and prevents potential issues if the code is
reordered in the future.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 net/sctp/auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index be9782760f50..84708f87392f 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -753,7 +753,7 @@ int sctp_auth_set_key(struct sctp_endpoint *ep,
 	/* Create a new key data based on the info passed in */
 	key = sctp_auth_create_key(auth_key->sca_keylength, GFP_KERNEL);
 	if (!key) {
-		kfree(cur_key);
+		sctp_auth_shkey_release(cur_key);
 		return -ENOMEM;
 	}
 
-- 
2.39.5 (Apple Git-154)


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

* Re: [PATCH v2 net-next] sctp: use sctp_auth_shkey_release() in error path for consistency
  2026-06-22 10:02 [PATCH v2 net-next] sctp: use sctp_auth_shkey_release() in error path for consistency Wentao Liang
@ 2026-06-25  2:01 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-06-25  2:01 UTC (permalink / raw)
  To: Wentao Liang
  Cc: Marcelo Ricardo Leitner, Xin Long, David S . Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman, linux-sctp, netdev, linux-kernel

On Mon, 22 Jun 2026 18:02:35 +0800 Wentao Liang wrote:
> Use the proper refcount-aware helper sctp_auth_shkey_release() instead
> of kfree() when freeing cur_key in the error path of sctp_auth_set_key().
> While both are equivalent in the current code, using the helper maintains
> abstraction consistency and prevents potential issues if the code is
> reordered in the future.

## Form letter - net-next-closed

We have already submitted our pull request with net-next material for v7.2,
and therefore net-next is closed for new drivers, features, code refactoring
and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after June 29th.

RFC patches sent for review only are obviously welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
-- 
pw-bot: defer
pv-bot: closed

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

end of thread, other threads:[~2026-06-25  2:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 10:02 [PATCH v2 net-next] sctp: use sctp_auth_shkey_release() in error path for consistency Wentao Liang
2026-06-25  2:01 ` Jakub Kicinski

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