summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorFredric Cover <FredTheDude@proton.me>2026-03-29 04:47:53 +0300
committerSteve French <stfrench@microsoft.com>2026-04-06 03:58:40 +0300
commitb3f5c2a41a0d0d2efbfb4dcdcdc086856562b28b (patch)
treed4dc808b5d76f8a002a542c6c3d800b644e60a9d /fs
parent591cd656a1bf5ea94a222af5ef2ee76df029c1d2 (diff)
downloadlinux-b3f5c2a41a0d0d2efbfb4dcdcdc086856562b28b.tar.xz
fs/smb/client: add verbose error logging for UNC parsing
Add cifs_dbg(VFS, ...) statements to smb3_parse_devname() to provide explicit feedback when parsing fails. Currently, the function returns -EINVAL silently, making it difficult to debug mount failures caused by malformed paths or missing share names. Signed-off-by: Fredric Cover <FredTheDude@proton.me> Acked-by: Henrique Carvalho <[2]henrique.carvalho@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/client/fs_context.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index a46764c24710..3f0faae99ed5 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -662,13 +662,17 @@ smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx)
/* make sure we have a valid UNC double delimiter prefix */
len = strspn(devname, delims);
- if (len != 2)
+ if (len != 2) {
+ cifs_dbg(VFS, "UNC: path must begin with // or \\\\\n");
return -EINVAL;
+ }
/* find delimiter between host and sharename */
pos = strpbrk(devname + 2, delims);
- if (!pos)
+ if (!pos) {
+ cifs_dbg(VFS, "UNC: missing delimiter between hostname and share name\n");
return -EINVAL;
+ }
/* record the server hostname */
kfree(ctx->server_hostname);
@@ -681,8 +685,10 @@ smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx)
/* now go until next delimiter or end of string */
len = strcspn(pos, delims);
- if (!len)
+ if (!len) {
+ cifs_dbg(VFS, "UNC: missing share name\n");
return -EINVAL;
+ }
/* move "pos" up to delimiter or NULL */
pos += len;