From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35F1133D51A for ; Sun, 19 Apr 2026 11:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776596589; cv=none; b=eYkRMzKWkgbfuD5if6us5hWAweBYs6yCPFx6xYw2LNL/Lftu/TfIeWdQY6UJXNVPpHymt/QYpG4OTQiyOjAQKJ5dGCfdu23u1YQtoBj6dXz7gPyaUw0oJe6p54XyMT9nlexcQOCHG+lHnaMkTjMgvvfLsvfXC8YZksmsF9pa+sc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776596589; c=relaxed/simple; bh=VyK4kxf1xc0HknGrvHpp7IfOxieIEAAxS73/8cca4bQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JkVmUEvOO00hIaVvB/n3Pq3mHp/ankeZrndlhB4Ee9+Vs5fnQ/GnkaT+5DGvUIRXzTJQht0NbNagGhr7ywP+SLmJEPtnqcQjNur/+Exy1A1TjdLeU0aXREMfL+iCVt+DkcbkyD6x8W/1T5/dbvcTYaC7Mf/Nuxhhram9Ybo1cBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JpLeJ91x; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JpLeJ91x" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-35e4617924eso345776a91.1 for ; Sun, 19 Apr 2026 04:03:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776596586; x=1777201386; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9DyStktkJgiHhlYyQA1PqDFemYtpoFBPyefLrK+uytk=; b=JpLeJ91xQvRPNzdxliKy0sKpi6YBzMjAUzWtL8AtBlA1ck/npt444vhx3Y/Fmp3VpO 2J0fQiSVXGQART1V02JV6S5jZF/3eDuFW0N3jMEGLjTijq28zmpHe0efuA9I/NdTg1yv p0ldn2KfR53nWmWLKNx3ZI+BzTkl8rYyAe300qou7UsEtzDAC25Swj1xuuMinES72IYs 61T2KJXXzV6KWv30o1+KFShjoYtG2nAEmBfOMv8ze5yM1c4ixwl3MtXDItAEbQkir1GQ 65QfXPVazFYloKYotjgov4OiCDVgU3x4ZQG8Y8ZvLMy27Us52ps0TBlFrqt90Besuc6/ Wslw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776596586; x=1777201386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9DyStktkJgiHhlYyQA1PqDFemYtpoFBPyefLrK+uytk=; b=YfToHsf1hE9i32xRKKRdB5986YAOVgSZf4eirZrbr8EnLAbw+5bpDAVuvyzevHIFkG YRdEvfFIIRLZ8ri8tC1j6X1SsLfYmch/fns8ugYeYCD3UEdYe8eZgu/XPf4i4TzrfRJX hPpS+XmFVULqBYr2W+LLlxsY6TqoFkllVpDqk/fPHO9KO4KZe+5mC5vRNrfXoXaVhj+K wFlYfvrk8u4A1WofabQetZvI2yKcR9XgNijnSRN/Rcy+0uhzab1Z4kaLtlMhCKyKMXfi 6TpKyF/4jDzqi/wtZ8SzYUJqTRJsqW7b1Bt767mbYlx7DbPXVbtvcU9tjySOB+SLPhV1 8dyQ== X-Forwarded-Encrypted: i=1; AFNElJ9jTp0wke9Uk0n1Qig6BFCpOydb9N3aAkYOvrAcU2UV7ZpuXMxCw58kRf4cDuGfqx4Ql/ghqbxuI5dQK+c=@vger.kernel.org X-Gm-Message-State: AOJu0YwcL5XzxyyfEZXV/6igaq6a/sR+CReE4ocsNskGX3Ja+d0tgGmK 0Yyuci6+y1oainyuWCQ5jvYLqcGfFT42M+W9hbzYqWB10AIwFoX6bzCs X-Gm-Gg: AeBDies7CR6uZvC2VsoHkcxIGx+8hLZ+8aK2ign/X2juS1NLa0hEOekbE7Jm/gJICEN n85rj2rCUN/k8KL60ybGQzTUoPUWYzTRlw60m1I2d20YJIIIKRiKaevA597GjvglScMgjleZQQC lN+m4aT0FDJwd4/eA4v8cIsgbQtJh6ez2KDHend2TbOFWSh72cThSeTFBqwAZVNJG4FpaWOMktA Fdgs+7rk9WPBQDwR3V8Sbj9lVxqFLZJYy6K3QNZfeLkEO4MOi2ScfOGNkYykDF3TtdIAxPROqvi Blp4tAbDTAaOJ6JHVmVLm6AaZ5gIKg2BDRbnF1KYCblfSPWhwIk+QaeyEWi1K0QHImT7WFp7h60 XsI/UV4+xRrxgkkWlTm2oHfmy3K6ULvA3ziKDHcf9zLKvr0xPjjrzERgk0Tc856Gt1t+rKoFSH1 lIshFBkcB12ro6epRceiuIoVEXBZY= X-Received: by 2002:a17:90b:4ccf:b0:35f:bd83:38c2 with SMTP id 98e67ed59e1d1-361403a686cmr5421740a91.1.1776596586452; Sun, 19 Apr 2026 04:03:06 -0700 (PDT) Received: from ser8.. ([221.156.231.192]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c797703059fsm5527972a12.24.2026.04.19.04.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2026 04:03:06 -0700 (PDT) From: DaeMyung Kang To: Namjae Jeon Cc: Steve French , Sergey Senozhatsky , Tom Talpey , linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, DaeMyung Kang Subject: [PATCH 2/2] ksmbd: destroy async_ida in ksmbd_conn_free() Date: Sun, 19 Apr 2026 20:02:55 +0900 Message-ID: <20260419110255.2477785-3-charsyam@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260419110255.2477785-1-charsyam@gmail.com> References: <20260419110255.2477785-1-charsyam@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When per-connection async_ida was converted from a dynamically allocated ksmbd_ida to an embedded struct ida, ksmbd_ida_free() was removed from the connection teardown path but no matching ida_destroy() was added. The connection is therefore freed with the IDA's backing xarray still intact. The kernel IDA API expects ida_init() and ida_destroy() to be paired over an object's lifetime, so add the missing cleanup before the connection is freed. No leak has been observed in testing; this is a pairing fix to match the IDA lifetime rules, not a response to a reproduced regression. Fixes: d40012a83f87 ("cifsd: declare ida statically") Signed-off-by: DaeMyung Kang --- fs/smb/server/connection.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/smb/server/connection.c b/fs/smb/server/connection.c index a4110c6cce37..8bbfe27387e3 100644 --- a/fs/smb/server/connection.c +++ b/fs/smb/server/connection.c @@ -98,6 +98,15 @@ void ksmbd_conn_free(struct ksmbd_conn *conn) kfree(conn->preauth_info); kfree(conn->mechToken); if (atomic_dec_and_test(&conn->refcnt)) { + /* + * async_ida is embedded in struct ksmbd_conn, so pair + * ida_destroy() with the final kfree() rather than with + * the unconditional field teardown above. This keeps + * the IDA valid for the entire lifetime of the struct, + * even while other refcount holders (oplock / vfs + * durable handles) still reference the connection. + */ + ida_destroy(&conn->async_ida); conn->transport->ops->free_transport(conn->transport); kfree(conn); } -- 2.43.0