Skip to content

Commit b3f5c2a

Browse files
Fredric Coversmfrench
authored andcommitted
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>
1 parent 591cd65 commit b3f5c2a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

fs/smb/client/fs_context.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,13 +662,17 @@ smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx)
662662

663663
/* make sure we have a valid UNC double delimiter prefix */
664664
len = strspn(devname, delims);
665-
if (len != 2)
665+
if (len != 2) {
666+
cifs_dbg(VFS, "UNC: path must begin with // or \\\\\n");
666667
return -EINVAL;
668+
}
667669

668670
/* find delimiter between host and sharename */
669671
pos = strpbrk(devname + 2, delims);
670-
if (!pos)
672+
if (!pos) {
673+
cifs_dbg(VFS, "UNC: missing delimiter between hostname and share name\n");
671674
return -EINVAL;
675+
}
672676

673677
/* record the server hostname */
674678
kfree(ctx->server_hostname);
@@ -681,8 +685,10 @@ smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx)
681685

682686
/* now go until next delimiter or end of string */
683687
len = strcspn(pos, delims);
684-
if (!len)
688+
if (!len) {
689+
cifs_dbg(VFS, "UNC: missing share name\n");
685690
return -EINVAL;
691+
}
686692

687693
/* move "pos" up to delimiter or NULL */
688694
pos += len;

0 commit comments

Comments
 (0)