3 cifs/smb3 fixes, 2 for stable, includes a reconnetct fix and fix for display of devnames with special characters

-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmBvsOIACgkQiiy9cAdy
 T1G90Qv+IEnZZClHENPxoefXE9hdMYflrZ0FgR1xAD0JJZDTjj0OIsilCfJxpDq5
 Wz4oXZT0WDuwOishMljGkdIUR+xdH8fILWsXhUJoa38zCzF4OZ7ld1zbBDblHLSw
 dR0bZJ5FmfXJmqMmrdl2ebLysQ2Xn0qCEn/6FiHABCKgoEvUcYJ95TMVnc6xyc+j
 x1dZbCmL0lQjRsUE+V918fFyAHJqWvlJC3dfEPl15ARgksEM/14f4o1Tp3tI3jZ1
 aVgPMsCb/ZC4Cwjr1NB7g66ymLKZZODl66wxM6zgNXQj72Ay2Sr2KeXT4WH6jspK
 mJQED27i20VtganGTBcZaULsupqd5+378G5Or1TDqEsDDq+Xg4+B+BBgojhBqSh6
 Czp1iZgZGHNaw/40t4ikeiNTqzQN3WNaiTAptsAew9MS2yvM4wsu1T2D70r0wQOI
 FytBASx/u60mu5BnomTaOSgvkOw4LJ9LJproqREdgyNcvSwqnqc3HkCRoWDxxcQc
 TCxr/i4a
 =rxNZ
 -----END PGP SIGNATURE-----

Merge tag '5.12-rc6-smb3' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
 "Three cifs/smb3 fixes, two for stable: a reconnect fix and a fix for
  display of devnames with special characters"

* tag '5.12-rc6-smb3' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: escape spaces in share names
  fs: cifs: Remove unnecessary struct declaration
  cifs: On cifs_reconnect, resolve the hostname again.
This commit is contained in:
Linus Torvalds 2021-04-08 18:57:47 -07:00
commit 17e7124aad
5 changed files with 22 additions and 8 deletions

View File

@ -18,6 +18,7 @@ config CIFS
select CRYPTO_AES select CRYPTO_AES
select CRYPTO_LIB_DES select CRYPTO_LIB_DES
select KEYS select KEYS
select DNS_RESOLVER
help help
This is the client VFS module for the SMB3 family of NAS protocols, This is the client VFS module for the SMB3 family of NAS protocols,
(including support for the most recent, most secure dialect SMB3.1.1) (including support for the most recent, most secure dialect SMB3.1.1)
@ -112,7 +113,6 @@ config CIFS_WEAK_PW_HASH
config CIFS_UPCALL config CIFS_UPCALL
bool "Kerberos/SPNEGO advanced session setup" bool "Kerberos/SPNEGO advanced session setup"
depends on CIFS depends on CIFS
select DNS_RESOLVER
help help
Enables an upcall mechanism for CIFS which accesses userspace helper Enables an upcall mechanism for CIFS which accesses userspace helper
utilities to provide SPNEGO packaged (RFC 4178) Kerberos tickets utilities to provide SPNEGO packaged (RFC 4178) Kerberos tickets
@ -179,7 +179,6 @@ config CIFS_DEBUG_DUMP_KEYS
config CIFS_DFS_UPCALL config CIFS_DFS_UPCALL
bool "DFS feature support" bool "DFS feature support"
depends on CIFS depends on CIFS
select DNS_RESOLVER
help help
Distributed File System (DFS) support is used to access shares Distributed File System (DFS) support is used to access shares
transparently in an enterprise name space, even if the share transparently in an enterprise name space, even if the share

View File

@ -10,13 +10,14 @@ cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \
cifs_unicode.o nterr.o cifsencrypt.o \ cifs_unicode.o nterr.o cifsencrypt.o \
readdir.o ioctl.o sess.o export.o smb1ops.o unc.o winucase.o \ readdir.o ioctl.o sess.o export.o smb1ops.o unc.o winucase.o \
smb2ops.o smb2maperror.o smb2transport.o \ smb2ops.o smb2maperror.o smb2transport.o \
smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o \
dns_resolve.o
cifs-$(CONFIG_CIFS_XATTR) += xattr.o cifs-$(CONFIG_CIFS_XATTR) += xattr.o
cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o
cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o dfs_cache.o cifs-$(CONFIG_CIFS_DFS_UPCALL) += cifs_dfs_ref.o dfs_cache.o
cifs-$(CONFIG_CIFS_SWN_UPCALL) += netlink.o cifs_swn.o cifs-$(CONFIG_CIFS_SWN_UPCALL) += netlink.o cifs_swn.o

View File

@ -476,7 +476,8 @@ static int cifs_show_devname(struct seq_file *m, struct dentry *root)
seq_puts(m, "none"); seq_puts(m, "none");
else { else {
convert_delimiter(devname, '/'); convert_delimiter(devname, '/');
seq_puts(m, devname); /* escape all spaces in share names */
seq_escape(m, devname, " \t");
kfree(devname); kfree(devname);
} }
return 0; return 0;

View File

@ -1283,8 +1283,6 @@ struct cifs_aio_ctx {
bool direct_io; bool direct_io;
}; };
struct cifs_readdata;
/* asynchronous read support */ /* asynchronous read support */
struct cifs_readdata { struct cifs_readdata {
struct kref refcount; struct kref refcount;

View File

@ -87,7 +87,6 @@ static void cifs_prune_tlinks(struct work_struct *work);
* *
* This should be called with server->srv_mutex held. * This should be called with server->srv_mutex held.
*/ */
#ifdef CONFIG_CIFS_DFS_UPCALL
static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
{ {
int rc; int rc;
@ -124,6 +123,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
return !rc ? -1 : 0; return !rc ? -1 : 0;
} }
#ifdef CONFIG_CIFS_DFS_UPCALL
/* These functions must be called with server->srv_mutex held */ /* These functions must be called with server->srv_mutex held */
static void reconn_set_next_dfs_target(struct TCP_Server_Info *server, static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
struct cifs_sb_info *cifs_sb, struct cifs_sb_info *cifs_sb,
@ -321,13 +321,28 @@ cifs_reconnect(struct TCP_Server_Info *server)
#endif #endif
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
if (cifs_sb && cifs_sb->origin_fullpath)
/* /*
* Set up next DFS target server (if any) for reconnect. If DFS * Set up next DFS target server (if any) for reconnect. If DFS
* feature is disabled, then we will retry last server we * feature is disabled, then we will retry last server we
* connected to before. * connected to before.
*/ */
reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it); reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
else {
#endif #endif
/*
* Resolve the hostname again to make sure that IP address is up-to-date.
*/
rc = reconn_set_ipaddr_from_hostname(server);
if (rc) {
cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n",
__func__, rc);
}
#ifdef CONFIG_CIFS_DFS_UPCALL
}
#endif
#ifdef CONFIG_CIFS_SWN_UPCALL #ifdef CONFIG_CIFS_SWN_UPCALL
} }