mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-13 04:39:36 +02:00
smb: client: handle path separator of created SMB symlinks
[ Upstream commit8bde59b20d
] Convert path separator to CIFS_DIR_SEP(cifs_sb) from symlink target before sending it over the wire otherwise the created SMB symlink may become innaccesible from server side. Fixes:514d793e27
("smb: client: allow creating symlinks via reparse points") Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1b5f2928cc
commit
fff4045e71
|
@ -5212,7 +5212,7 @@ static int smb2_create_reparse_symlink(const unsigned int xid,
|
||||||
struct inode *new;
|
struct inode *new;
|
||||||
struct kvec iov;
|
struct kvec iov;
|
||||||
__le16 *path;
|
__le16 *path;
|
||||||
char *sym;
|
char *sym, sep = CIFS_DIR_SEP(cifs_sb);
|
||||||
u16 len, plen;
|
u16 len, plen;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
@ -5226,7 +5226,8 @@ static int smb2_create_reparse_symlink(const unsigned int xid,
|
||||||
.symlink_target = sym,
|
.symlink_target = sym,
|
||||||
};
|
};
|
||||||
|
|
||||||
path = cifs_convert_path_to_utf16(symname, cifs_sb);
|
convert_delimiter(sym, sep);
|
||||||
|
path = cifs_convert_path_to_utf16(sym, cifs_sb);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -5249,7 +5250,10 @@ static int smb2_create_reparse_symlink(const unsigned int xid,
|
||||||
buf->PrintNameLength = cpu_to_le16(plen);
|
buf->PrintNameLength = cpu_to_le16(plen);
|
||||||
memcpy(buf->PathBuffer, path, plen);
|
memcpy(buf->PathBuffer, path, plen);
|
||||||
buf->Flags = cpu_to_le32(*symname != '/' ? SYMLINK_FLAG_RELATIVE : 0);
|
buf->Flags = cpu_to_le32(*symname != '/' ? SYMLINK_FLAG_RELATIVE : 0);
|
||||||
|
if (*sym != sep)
|
||||||
|
buf->Flags = cpu_to_le32(SYMLINK_FLAG_RELATIVE);
|
||||||
|
|
||||||
|
convert_delimiter(sym, '/');
|
||||||
iov.iov_base = buf;
|
iov.iov_base = buf;
|
||||||
iov.iov_len = len;
|
iov.iov_len = len;
|
||||||
new = smb2_get_reparse_inode(&data, inode->i_sb, xid,
|
new = smb2_get_reparse_inode(&data, inode->i_sb, xid,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user