diff options
author | Paulo Alcantara <pc@manguebit.com> | 2023-06-27 21:24:47 -0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-06-28 11:48:56 -0500 |
commit | 49024ec8795ed2bd7217c249ef50a70c4e25d662 (patch) | |
tree | 4df4277d2a82273da28c5a200ceec7da205778b5 /fs/smb/client/cifsproto.h | |
parent | d439b29057e26464120fc6c18f97433aa003b5fe (diff) | |
download | linux-stable-49024ec8795ed2bd7217c249ef50a70c4e25d662.tar.gz linux-stable-49024ec8795ed2bd7217c249ef50a70c4e25d662.tar.bz2 linux-stable-49024ec8795ed2bd7217c249ef50a70c4e25d662.zip |
smb: client: fix parsing of source mount option
Handle trailing and leading separators when parsing UNC and prefix
paths in smb3_parse_devname(). Then, store the sanitised paths in
smb3_fs_context::source.
This fixes the following cases
$ mount //srv/share// /mnt/1 -o ...
$ cat /mnt/1/d0/f0
cat: /mnt/1/d0/f0: Invalid argument
The -EINVAL was returned because the client sent SMB2_CREATE "\\d0\f0"
rather than SMB2_CREATE "\d0\f0".
$ mount //srv//share /mnt/1 -o ...
mount: Invalid argument
The -EINVAL was returned correctly although the client only realised
it after sending a couple of bad requests rather than bailing out
earlier when parsing mount options.
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/cifsproto.h')
-rw-r--r-- | fs/smb/client/cifsproto.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h index d127aded2f28..293c54867d94 100644 --- a/fs/smb/client/cifsproto.h +++ b/fs/smb/client/cifsproto.h @@ -85,6 +85,8 @@ extern void release_mid(struct mid_q_entry *mid); extern void cifs_wake_up_task(struct mid_q_entry *mid); extern int cifs_handle_standard(struct TCP_Server_Info *server, struct mid_q_entry *mid); +extern char *smb3_fs_context_fullpath(const struct smb3_fs_context *ctx, + char dirsep); extern int smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx); extern int smb3_parse_opt(const char *options, const char *key, char **val); extern int cifs_ipaddr_cmp(struct sockaddr *srcaddr, struct sockaddr *rhs); |