{"id":2224886,"url":"http://patchwork.ozlabs.org/api/1.1/covers/2224886/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/cover/20260419110255.2477785-1-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-1-charsyam@gmail.com>","date":"2026-04-19T11:02:53","name":"[0/2] ksmbd: pair ida_init() with ida_destroy() in cleanup paths","submitter":{"id":93166,"url":"http://patchwork.ozlabs.org/api/1.1/people/93166/?format=json","name":"DaeMyung Kang","email":"charsyam@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/cover/20260419110255.2477785-1-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/covers/2224886/comments/","headers":{"Return-Path":"\n <linux-cifs+bounces-10913-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=Na1LfKDD;\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-10913-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=\"Na1LfKDD\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.216.43","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 4fz5Ly5W1Dz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 21:03:06 +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 D4AB3300E14D\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 11:03:04 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 904AF1C6FF5;\n\tSun, 19 Apr 2026 11:03:02 +0000 (UTC)","from mail-pj1-f43.google.com (mail-pj1-f43.google.com\n [209.85.216.43])\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 52AD12032D\n\tfor <linux-cifs@vger.kernel.org>; Sun, 19 Apr 2026 11:03:01 +0000 (UTC)","by mail-pj1-f43.google.com with SMTP id\n 98e67ed59e1d1-35e4617924eso345764a91.1\n        for <linux-cifs@vger.kernel.org>;\n Sun, 19 Apr 2026 04:03:01 -0700 (PDT)","from ser8.. ([221.156.231.192])\n        by smtp.gmail.com with ESMTPSA id\n 41be03b00d2f7-c797703059fsm5527972a12.24.2026.04.19.04.02.58\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sun, 19 Apr 2026 04:03:00 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776596582; cv=none;\n b=qD4IvKnJeYxv4WL+jwV/5Wus/lAbURIPcaVaLP3c6RYoIM++KFkQJAB9HLhR9Tf16l4a/INJH697vpxz6ZPG3iB9GDDNg+UuPv9Y15TrBsSbrziveaTuczArNutn1arAkxb4UFPDs3Wczk4heo3xNq8LdW9bdv8NL66ZV4Otpvc=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776596582; c=relaxed/simple;\n\tbh=ijj/N4N9O/ac6EUfDf/gAEdbFUx8EN8wOGtiExOehyw=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=UmSNfG7/hAyIz9E8ZG1O4DPkuULCkhJThvyKS+3jB1VsvYSKQeAKqID/GR6EI4iED/M+LGaGOHyxfJO6IG7rkxjW48UEhw6XQ5y707zanUNYjIjve7xP9uPC1AwJkoZvo6cVoz/02FvmAB74IT/S0GqNiT3hAlbXH9mH5aGbRLM=","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=Na1LfKDD; arc=none smtp.client-ip=209.85.216.43","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1776596581; x=1777201381;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=rBKKtrGOZEceLaJ96OZS5seFZGwhn2z6dS1FO47hYVk=;\n        b=Na1LfKDDNHwr5c3qhsjUbKzBEyOPJ+DTeFbQn2ACfg/l7nRoePPfdB4Tpg6hXDfJWi\n         P8l6bpAsChk0Ry2SFWsywM0Le/uDQosF4mBfJ0dOwQy5nYwUWNcaSC/SJWBelg5btkgt\n         mWu8A1WVQIRkaMarC0YFHY7HkUpSOXUGyVWO+mctoRvn1gq/xNn/pp34UHipMfV0MCIk\n         tiyyWyFdWB2dAyy5sHucKOHiHwako7f3gF7t0pc8l+t+SFxSnxCEGP9/5YlA0Ai45xFu\n         D7OsEv2lJkdDZDAoQA9+QnhKrpaBkGcEw0q1fSjKBcH9jSAdGCiAn8SP74v2Gvu+FlIH\n         v/Mw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776596581; x=1777201381;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=rBKKtrGOZEceLaJ96OZS5seFZGwhn2z6dS1FO47hYVk=;\n        b=GcWzOlEtJjruyXGleEqYsQGR1DIYUWAh1G93sALCckc8SQ//wSV+DAzvh3VOhuH0HO\n         d7i90pzJQrVp+H5PEvnY8qSOpXABOskNbJGti/ktE5ifuHMJ/+lJpTLpUlp9Og9JxrSA\n         QMIJL3y9YRB9MD5pOiy790Bkr5qKsH5jDdkGj/nbPEm67Wnf0rbwF3QTNZwePzdvnrEI\n         onUPjDzGXCJqeMZqxkf1Wt/GgYwkguF9ImON6Lx1weLuYEWypswWVmIC77L72VmAztUh\n         ngCjwJQFBtCWW1JDcbKeGoez0xjm1KCdytxnbT8gAuY0lSLtHXTK+Lmb9wBNMoSRdrXw\n         Z5SA==","X-Forwarded-Encrypted":"i=1;\n AFNElJ9lBB7MR03zUaX3ETHvyAONhCn2qyDww3QiLXE0Wkhr/nGS/agtopuOqnD7cuzi5ScDh49pqdrOUKu/@vger.kernel.org","X-Gm-Message-State":"AOJu0YyaKckNF1/1eTnv7SsuX7+XSSADK82CnNv6MoRu4cb6lBKLHCQt\n\tfmwtDS4OO992wlflqMXLbkc6Q9jP9A9+yqZxdZAHMqHW+go6aYG2p19P","X-Gm-Gg":"AeBDiestEjpEkkbtGCPcfptesIm6kLkKIwFDa4tofi48NhAU62sf1qJHhS5gseTVpLW\n\t7iS7z2jSJIbC/e3zujP+0BV8SnPeR7RfHgUYdIopvu/NfmIlOhJxku+xiVtq+3hlgZ7vHAV3e8D\n\tch+SA7vMuv5VdsypNYUrb45Elb7DnWkh/7mHOQsP+jHjFJh9TnGsht8QZ6eEaNb8mCIUZ5NxSFw\n\tni1wHO1cN7hWn5iQbqK3dJTtp9McMtn0ReYL97HHp8cj2NzljlrEBYaNEMCI5KVPLyAoXKn0UOb\n\tAvK/SzXwl5HvN/tlyS16YlqdH6zczrQm8WygX/x4jQg/fW+jBVBipZF1e15PbhtudN/wg8GOysQ\n\tkUsCdhitvJLGxSv5labSOwJyT9LgdYLUcDEKDRMtPVTwfvLpkT1TuyDj9lVeqg3wlFqhUqvCfOc\n\tj6scv1ghHcSXEj9fZlPZ2tCD9Z6uzjTIjOQxdX1w==","X-Received":"by 2002:a17:90b:2cc6:b0:35a:329:73c7 with SMTP id\n 98e67ed59e1d1-361403a6824mr5269791a91.2.1776596580557;\n        Sun, 19 Apr 2026 04:03:00 -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 0/2] ksmbd: pair ida_init() with ida_destroy() in cleanup\n paths","Date":"Sun, 19 Apr 2026 20:02:53 +0900","Message-ID":"<20260419110255.2477785-1-charsyam@gmail.com>","X-Mailer":"git-send-email 2.43.0","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":"Two small IDA cleanup fixes.  Both instances share the same history:\nwhen the per-object IDA was converted from a dynamically allocated\nksmbd_ida (which had ksmbd_ida_free() called at destruction) to an\nembedded struct ida initialised with ida_init(), the matching\nida_destroy() was not added to the teardown path.  The enclosing\nobject is freed with the IDA's backing xarray still intact.\n\n  1/2  ksmbd_session_destroy() frees the session without destroying\n       sess->tree_conn_ida.  This patch also moves ida_init() to\n       right after the session allocation so that the init/destroy\n       pairing holds on the early error paths of __session_create()\n       as well.\n\n  2/2  ksmbd_conn_free() frees the connection without destroying\n       conn->async_ida.  ksmbd_conn_alloc() has no failure path\n       after ida_init(), so no init-site move is required.  The\n       destroy is placed inside the final refcount branch (next to\n       kfree(conn)) rather than with the unconditional field teardown\n       because async_ida is embedded in struct ksmbd_conn and its\n       storage must stay valid while other refcount holders\n       (oplock / vfs durable handles) still reference the struct.\n\nNo leak has been observed in testing; both are pairing fixes to match\nIDA lifetime rules, not responses to reproduced regressions.  Cc:\nstable is intentionally omitted for the same reason.\n\nTested on top of current linux-next inside virtme-ng with\nCONFIG_PROVE_LOCKING, CONFIG_DEBUG_OBJECTS, CONFIG_DEBUG_KMEMLEAK,\nCONFIG_DEBUG_ATOMIC_SLEEP and CONFIG_FAILSLAB enabled.  Exercises:\n\n * 25x mount / umount via loopback cifs client with 3% failslab\n   injection to cover ksmbd_init_file_table() and\n   __init_smb2_session() failures on the __session_create() error\n   path (which now reaches ksmbd_session_destroy() with an\n   already-initialised tree_conn_ida).\n * Concurrent 32 MiB SMB2 reads followed by ksmbd.control\n   --shutdown to drive async request teardown.\n * rmmod ksmbd afterwards.\n\nNo splats (BUG:, WARNING:, UBSAN, ODEBUG, task hung, inconsistent\nlock, suspicious RCU) and no kmemleak unreferenced objects.\n\nDaeMyung Kang (2):\n  ksmbd: destroy tree_conn_ida in ksmbd_session_destroy()\n  ksmbd: destroy async_ida in ksmbd_conn_free()\n\n fs/smb/server/connection.c        | 9 +++++++++\n fs/smb/server/mgmt/user_session.c | 5 +++--\n 2 files changed, 12 insertions(+), 2 deletions(-)\n\n--\n2.43.0"}