From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EBCA5187EF; Wed, 30 Sep 2026 17:57:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790791072; cv=none; b=n/R3apNHkb/nzqz39EcZ+I21BJjaXHD8f0DTzqdpTj0AsBHaG9hWObOQSijMG+TZaKIS9HV037gaKYF0RaMCPSfWTfgp64qPbcOf+GhO8642EyJO3rTeGx3z742iNxApKuQfXE52+kyzLLOjIi+UHgB2vMeWJ8YSqgTm7l5Wn9E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790791072; c=relaxed/simple; bh=g92l1x/VtNUf77kFKGZ35nPq4yUA9VbfPNWZug9Nw3U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tCdulgKFFrw10or2WnhNIn4bATP54Rkx6arPAQDJfWWK7NbN3wg5WfGKAhfOrLNkDwiA7yH4rQmmL3DZtspVmv8REPmTE+KTCwS80GuU2o4V1PuEv6rG0bBN/rPed8fGUk9BChBPkN3wx3qMr2GfCGebgPRdperIHX3Vz4ApknE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pHpnJ3u9; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pHpnJ3u9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C982C1F000FF; Wed, 30 Sep 2026 17:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790791071; bh=K5FFEK2ExB/UOvrRti7jXUVpqirI8eUojZdeceWCiZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pHpnJ3u94lYQvmt80HBV8woOP5kBaRWY9c54da/Mcush4mC7W2V15IFPNR6Ou0cRj S3HLN34G+1/7Ka7lDMQX0QXRwoIH49lgsTtEg+69u/Q7IFyRQxef7dW8e6PNBETEn0 DsvEq1O/g7+LcYgNNrt5+BiD8dYJJVqoi5GK9z80= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Namjae Jeon , Steve French , Sasha Levin Subject: [PATCH 5.15 172/752] ksmbd: treat unnamed DATA stream as base file Date: Wed, 30 Sep 2026 17:20:42 +0200 Message-ID: <20260930152401.925087340@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152358.131179731@linuxfoundation.org> References: <20260930152358.131179731@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Namjae Jeon [ Upstream commit 171b5d72dd80f99271c073c6e38d5263687c3b6d ] The SMB path suffix :: names the unnamed data stream of the base file, not an alternate data stream backed by a DosStream xattr. Canonicalize an empty stream name with an explicit type to a NULL stream name after parsing. This keeps the base filename produced by strsep() and lets open continue through the normal base-file path instead of looking for a non-existent empty stream xattr. Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/ksmbd/misc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/ksmbd/misc.c b/fs/ksmbd/misc.c index 9e8afaa686e3a..11314f7c622a6 100644 --- a/fs/ksmbd/misc.c +++ b/fs/ksmbd/misc.c @@ -121,7 +121,9 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type) char *stream_type; char *s_name; int rc = 0; + bool has_stream_type = false; + *stream_name = NULL; s_name = filename; filename = strsep(&s_name, ":"); ksmbd_debug(SMB, "filename : %s, streams : %s\n", filename, s_name); @@ -137,14 +139,20 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type) ksmbd_debug(SMB, "stream name : %s, stream type : %s\n", s_name, stream_type); - if (!strncasecmp("$data", stream_type, 5)) + if (!strncasecmp("$data", stream_type, 5)) { *s_type = DATA_STREAM; - else if (!strncasecmp("$index_allocation", stream_type, 17)) + has_stream_type = true; + } else if (!strncasecmp("$index_allocation", stream_type, 17)) { *s_type = DIR_STREAM; - else + has_stream_type = true; + } else { rc = -ENOENT; + } } + if (has_stream_type && !s_name[0] && *s_type == DATA_STREAM) + goto out; + *stream_name = s_name; out: return rc; -- 2.53.0