From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 82B1238CFE7 for ; Sun, 24 May 2026 05:42:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779601368; cv=none; b=mJH6e1sEtqBkzwYdjJxTqwJw92tpxFHkRLSI1nGjiZwhJcs7BggylqYQ1u75dpONIdfVu2CGnQegMQx1nz541/NfjXCSyfekcT1RVAwzL1OQW3ZzhElK6/KMH5IeJsmkfTNDSUgZa0xFm2Obi5Y20mpyd82Np7Y8FAup32dCTiM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779601368; c=relaxed/simple; bh=G9Y04Vr5T7wG0e0exZw7O24VZHQbDNIe+7kN4TkOKKE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lRQneowNuRR2wSxrPeKcLHMf916S5UDE+RYVXFz1pomySXLM2mF2hTprWMvZDVg09gSNvPoli7lsOZ+axJSTW9PetbINp5jZthPjb5WHzcU20KEpgdxPIXNZlQ7VTw1vN/YpGsNIPkkfIL0YDVrhoQZ1ny+rGzhfo3qXONairWY= 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=XQQI7+Ou; arc=none smtp.client-ip=209.85.214.178 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="XQQI7+Ou" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2bcee5f0d01so13312175ad.0 for ; Sat, 23 May 2026 22:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779601366; x=1780206166; 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=meZqVzUjollE5pQHgO4NuBh2AucH33iC2AvQiTWocGU=; b=XQQI7+OudhC48bK0xUwCBtW/fRfD6gU4g5iD8YVP3xzUsyYP0Cfl7jxCjpnPFCvr/Q 66ctAcynCaBoS5FleM4a1FsBke6/FtuVsh6jgZXxFuJJaf+QwSS9YaqnynNQWCZP43z9 oNaNI1lqajSjOh56CYhx/ap6yrjuAy/hcY0xMIrDpx611RXGDV6FkkipkOKoY6qBEgEA sQCHdGntFbb8Bz5gabvE3tUeM/4IjdCp8/kyTzTp0FrZ9MmBQEuujUnbi906RTTuPH5S ep7TAtiT+2JjkvPz+kabzPgYwI1LPyv00GosD7GLqlANw2fFg3fU9rdtViJy88aJOPHZ v+aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779601366; x=1780206166; 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=meZqVzUjollE5pQHgO4NuBh2AucH33iC2AvQiTWocGU=; b=pbVD7wt7z9NDGPUUgdaRzzolMttHqYEU5iMqaMHrSsV7u/PVPaMVSfH1pHPmIcRtfn TW8H4K5M3mgiYGIJtADpX6KLyu05R954Uefk6DvIlIzAtHP7XkDvIq3C5/TxO0204FzD rb2o/MqrM5iCRkuQISEoeopDa0sOWpeoNbPD3sYz3gan/B4lC8aj8KGenkFD9LO27aTb ATa0/u7w6NFFRbSEjslhCgL/RmkIWEA//acIK2gmqZGspIAElmczgSlzT1ez3eu1mY19 fzXykr8YKusPI1dk9uGMM/3W7NU8yEJ3//eI17Nq3HfLPdzV8vz6QFRg2Ab0VmMPffpY 7A7Q== X-Forwarded-Encrypted: i=1; AFNElJ/xYuXL0E7QvxawQ9Fdf4NjuUKWxoWTK31QYS1CR7pTiNQBfwNEuC384izxmxzuH3qbgnafPq9lW/tszek=@vger.kernel.org X-Gm-Message-State: AOJu0YxjZ6nzamq29LlDJak6DtiIHILbz3AyYmiVQzawy6A56xxoqubO 3g64dR5wSI9jYS2h5zWqTQ6pCupTW4Ea7hc1mle1BMUFLDNNCJdD7E49C1YqFw== X-Gm-Gg: Acq92OGXhXSbXXA/ykbXNtV0lV6SiqVchuDmuIPFmyWwuJ4ZZwxAlSISR0BkMrZ+fD7 T3M99t3CYGQONHvlxZq7vUZUuOUJ9P/f2SPyephws/9AENvqYCDPl88KuI9yYiYgqVILH0OSA0H FQUkmnRzn0+KLeSe3IKYqFOZmQ9thdA2DTrkVFozVt8kGiS1ebkyKRLQwR/DJIdTWvwoMCedt8/ do5F3SiwuHhbblK4bCoi3gz6IeCe7i4YPjXyYq4itgAXaxePn3dH8P3Zed5sT95V54qGMbZ0vhT 609XK5XE1pjYJee2qEOC6Xfr/nqMQV4UxrG8/bsnvRgU3qAJkGi4XZlCaBSqNmFpPvyk9P+75sH xxqkgXIkUYMXCWSFgOaBRpx7Y/f5Cp5Pu125su36AbUMvF5KqjZbDc/VztzinCy3qt2FKkJk4th D4zFjXBD6kt+6fF4+5 X-Received: by 2002:a05:6a00:2d83:b0:835:36f2:7332 with SMTP id d2e1a72fcca58-8415f0d7b2dmr5242919b3a.2.1779601366503; Sat, 23 May 2026 22:42:46 -0700 (PDT) Received: from ser8.. ([221.156.231.192]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84164ff7d80sm6726848b3a.56.2026.05.23.22.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 22:42:45 -0700 (PDT) From: DaeMyung Kang To: Namjae Jeon , Hyunchul Lee Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, DaeMyung Kang Subject: [PATCH 1/2] ntfs: free link name from ntfs_name_cache Date: Sun, 24 May 2026 14:42:37 +0900 Message-ID: <20260524054238.3129288-2-charsyam@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260524054238.3129288-1-charsyam@gmail.com> References: <20260524054238.3129288-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 ntfs_link() converts the new link name with ntfs_nlstoucs() using NTFS_MAX_NAME_LEN. In this case ntfs_nlstoucs() allocates the result from ntfs_name_cache, and its contract requires callers to release the buffer with kmem_cache_free(ntfs_name_cache, ...). All other ntfs_nlstoucs() callers in namei.c do that, but ntfs_link() uses kfree(), which mismatches the allocator for successfully converted names. The conversion failure path reaches the common out label with uname == NULL. That was harmless for kfree(), but kmem_cache_free() does not provide the same NULL contract. Return directly on conversion failure and free successful conversions with ntfs_name_cache. Fixes: af0db57d4293 ("ntfs: update inode operations") Signed-off-by: DaeMyung Kang --- fs/ntfs/namei.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c index c4f82846c58c..9c1c36acfad2 100644 --- a/fs/ntfs/namei.c +++ b/fs/ntfs/namei.c @@ -1532,8 +1532,7 @@ static int ntfs_link(struct dentry *old_dentry, struct inode *dir, if (uname_len < 0) { if (uname_len != -ENAMETOOLONG) ntfs_error(sb, "Failed to convert name to unicode."); - err = -ENOMEM; - goto out; + return -ENOMEM; } if (!(vol->vol_flags & VOLUME_IS_DIRTY)) @@ -1563,7 +1562,7 @@ static int ntfs_link(struct dentry *old_dentry, struct inode *dir, mutex_unlock(&ni->mrec_lock); out: - kfree(uname); + kmem_cache_free(ntfs_name_cache, uname); return err; } -- 2.43.0