{"id":2224887,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2224887/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260419110255.2477785-2-charsyam@gmail.com/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.1/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260419110255.2477785-2-charsyam@gmail.com>","date":"2026-04-19T11:02:54","name":"[1/2] ksmbd: destroy tree_conn_ida in ksmbd_session_destroy()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2fc795a93359ff505379bffbd94b98a22c85cf2f","submitter":{"id":93166,"url":"http://patchwork.ozlabs.org/api/1.1/people/93166/?format=json","name":"DaeMyung Kang","email":"charsyam@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260419110255.2477785-2-charsyam@gmail.com/mbox/","series":[{"id":500494,"url":"http://patchwork.ozlabs.org/api/1.1/series/500494/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=500494","date":"2026-04-19T11:02:53","name":"ksmbd: pair ida_init() with ida_destroy() in cleanup paths","version":1,"mbox":"http://patchwork.ozlabs.org/series/500494/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224887/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224887/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-10914-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=l5NGDLQA;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10914-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"l5NGDLQA\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.216.42","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fz5MM1c5Nz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 21:03:27 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 44A463012312\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 11:03:10 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C7A6333B975;\n\tSun, 19 Apr 2026 11:03:05 +0000 (UTC)","from mail-pj1-f42.google.com (mail-pj1-f42.google.com\n [209.85.216.42])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 96526330328\n\tfor <linux-cifs@vger.kernel.org>; Sun, 19 Apr 2026 11:03:04 +0000 (UTC)","by mail-pj1-f42.google.com with SMTP id\n 98e67ed59e1d1-3597822d6d8so404077a91.3\n        for <linux-cifs@vger.kernel.org>;\n Sun, 19 Apr 2026 04:03:04 -0700 (PDT)","from ser8.. ([221.156.231.192])\n        by smtp.gmail.com with ESMTPSA id\n 41be03b00d2f7-c797703059fsm5527972a12.24.2026.04.19.04.03.01\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sun, 19 Apr 2026 04:03:03 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776596585; cv=none;\n b=ruIPLfs0g5rgExMLnW4U270efWO8G62gAz8GlFT0FrqCHYcdtDL27j5IlC53VnT/5q9x1TZHR1WY9y3Da1OcpbBj8qjKwEufUeZ/n9p1TzbecbYykixBGhEqnF9YI+G3ddooW100iOh6D3cKsu2rb/jnC/WOBjgwGGSQkenA4yc=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776596585; c=relaxed/simple;\n\tbh=3cxEUH0rl5qi1K4eVOi/flkQwufK+SdR0pp9z1HPhgI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=E944bA1vc/JLwV1En+afDCTPKx5cJa42wlEQfD7EpJqjgaTQqpWuv2+WDIX63kRD2joiuJexsfaSc5rB3LTvFRzj0/GZj3OSSQDdgSm9+ZmVgXh/SvKRJ1yTvcugI9TeXT7UVWBwCqvVd1vEZd2XegOKOaLxuS1qAW0+dIdyS54=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=l5NGDLQA; arc=none smtp.client-ip=209.85.216.42","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1776596584; x=1777201384;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=pFPV09e5vgRJrLGBoxQYyojuTqO2sidsKfMnvaM2Sb4=;\n        b=l5NGDLQAumdrevlt3zuKbyYE5PvxHQD7rS7KhtmNq2Fj9CZfz+wrdOuLfYG+yRDKJc\n         VcSKRazKIrJ+LzxiYAOdCrSh71hd9ITkuhv8MT/drlqm1GUxcYqMIbCFXhb3W4HZiNII\n         cSGF8ZORODHsFGOib28h9OrU4/UgyEs2Lg1mgVi0+i0W4FznXHMS1jh2/z2qrcqvG0/g\n         UgoBAFLqRk2wQ7u42s6lEYvsJDOwusAAUNEyUos7fUZnaAw7GONRkFUkY4CgPYCnLXso\n         rzCFfR3oLi1ZKHRq50reCZYxFyKTb7ZtXhpnMn2XQ+nIlsKTQHtQpLCmTH0P0+xsGWzF\n         CTQw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776596584; x=1777201384;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=pFPV09e5vgRJrLGBoxQYyojuTqO2sidsKfMnvaM2Sb4=;\n        b=o0FnQa1i4lcKtvvbx3r2r61OAfLNYeFwVcc5MXkMootkgUbiV6aPJHdcRLWPb6/ucI\n         ezxbuEiWVAgEQmrj/5xnDroojjByR0go+5a5k73Ugcsv4iMlX8awkICuufPFqoMqPZhu\n         XUd5OTO5Irk9Jh7V5nzfoyPAMdwg8AGMgHGf8j0Q1kUHxXbON4IozHfUAv55nOAMLFQJ\n         K9MK//ol3iT9ajoJY3imsBrodN54ForRge/6tbDTfKqk9jFdpXjE6r0/wenHg/GIG/9/\n         LSpLQ5w6t//50lfsO/dJ98hO4IpdBcNZrcfbRbY9K9wwuLSHvzQzPOAllKRxP3XTDvkj\n         W0vw==","X-Forwarded-Encrypted":"i=1;\n AFNElJ+M0CHG5Q90qkAYKLn3yU0SuVncZzB2eFsAAmwBFgYjoLXsFGxT40XyZcgw+tuJYs1p4Eyd/Yqxqcpz@vger.kernel.org","X-Gm-Message-State":"AOJu0YwAxG+GaR0kzRME/1FvPyc9JPeCxFenC1eS4IYHCKiWOZg23d56\n\tO8D2O6Mb/gVn+x/+AzaMZCPh17DUw4KeowRYbGuEUtPNBGmBnQuWxuT3woCA06Jp","X-Gm-Gg":"AeBDietngoEvRf2mBw9lLlpP8SYV4PMG7vDq1jDTxmfwvJ1/xeCePDUzVorHiYpLyR5\n\tkeRMrnifd/RPhb5gF4H8k0zz9SPVGBocau8fKl8PcsSYL8hpfQfYaHRGOIoO/xmpmftsQjBUkjL\n\tWMetClf3SAVd9ELWt28spGcBKJuNqp8MPoeRLy66z5b6qWVt20RexTEveGGQl39H03eI8Spng8t\n\tLWZS+dVUgi4BSq9oW61d4LRCHbK9tszLOQ7eArXV3AnDyR8l3VkS6mGp8QAnYYeIimUwl1FXa3P\n\tNhskV/i/Gf7ITiwmHMK3zls/og3T2knMv6I+k0J6XGTJ+C0vz7x0y89c7zIvdLSUBQEZm49CVKA\n\t8GCpIeyX4aXGVeQAR4hGjrdGZBFRBJbW6GBaDBUtv2+mEucthYiCnNL+vaifrmzhGIks0RHLcpn\n\tnrVGVQR2TnEqOOehYKWf4jLL2dIO8=","X-Received":"by 2002:a17:90a:d604:b0:35b:94db:fdaf with SMTP id\n 98e67ed59e1d1-3614044f697mr5319706a91.4.1776596583718;\n        Sun, 19 Apr 2026 04:03:03 -0700 (PDT)","From":"DaeMyung Kang <charsyam@gmail.com>","To":"Namjae Jeon <linkinjeon@kernel.org>","Cc":"Steve French <smfrench@gmail.com>,\n\tSergey Senozhatsky <senozhatsky@chromium.org>,\n\tTom Talpey <tom@talpey.com>,\n\tlinux-cifs@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tDaeMyung Kang <charsyam@gmail.com>","Subject":"[PATCH 1/2] ksmbd: destroy tree_conn_ida in ksmbd_session_destroy()","Date":"Sun, 19 Apr 2026 20:02:54 +0900","Message-ID":"<20260419110255.2477785-2-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-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"When per-session tree_conn_ida was converted from a dynamically\nallocated ksmbd_ida to an embedded struct ida, ksmbd_ida_free() was\nremoved from ksmbd_session_destroy() but no matching ida_destroy()\nwas added.  The session is therefore freed with the IDA's backing\nxarray still intact.\n\nThe kernel IDA API expects ida_init() and ida_destroy() to be paired\nover an object's lifetime, so add the missing cleanup before the\nenclosing session is freed.\n\nAlso move ida_init() to right after the session is allocated so that\nit is always paired with the destroy call even on the early error\npaths of __session_create() (ksmbd_init_file_table() or\n__init_smb2_session() failures), both of which jump to the error\nlabel and invoke ksmbd_session_destroy() on a partially initialised\nsession.\n\nNo leak has been observed in testing; this is a pairing fix to match\nthe IDA lifetime rules, not a response to a reproduced regression.\n\nFixes: d40012a83f87 (\"cifsd: declare ida statically\")\nSigned-off-by: DaeMyung Kang <charsyam@gmail.com>\n---\n fs/smb/server/mgmt/user_session.c | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)","diff":"diff --git a/fs/smb/server/mgmt/user_session.c b/fs/smb/server/mgmt/user_session.c\nindex a86589408835..0dd9e6c976ac 100644\n--- a/fs/smb/server/mgmt/user_session.c\n+++ b/fs/smb/server/mgmt/user_session.c\n@@ -391,6 +391,7 @@ void ksmbd_session_destroy(struct ksmbd_session *sess)\n \tfree_channel_list(sess);\n \tkfree(sess->Preauth_HashValue);\n \tksmbd_release_id(&session_ida, sess->id);\n+\tida_destroy(&sess->tree_conn_ida);\n \tkfree(sess);\n }\n \n@@ -665,6 +666,8 @@ static struct ksmbd_session *__session_create(int protocol)\n \tif (!sess)\n \t\treturn NULL;\n \n+\tida_init(&sess->tree_conn_ida);\n+\n \tif (ksmbd_init_file_table(&sess->file_table))\n \t\tgoto error;\n \n@@ -684,8 +687,6 @@ static struct ksmbd_session *__session_create(int protocol)\n \tif (ret)\n \t\tgoto error;\n \n-\tida_init(&sess->tree_conn_ida);\n-\n \tdown_write(&sessions_table_lock);\n \thash_add(sessions_table, &sess->hlist, sess->id);\n \tup_write(&sessions_table_lock);\n","prefixes":["1/2"]}