Skip to content

Commit

Permalink
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Browse files Browse the repository at this point in the history
Pull cifs version warning fix from Steve French:
 "As requested, additional kernel warning messages to clarify the
  default dialect changes"

[ There is still some discussion about exactly which version should be
  the new default.  Longer-term we have auto-negotiation coming, but
  that's not there yet..  - Linus ]

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
  Fix warning messages when mounting to older servers
  • Loading branch information
Linus Torvalds committed Sep 2, 2017
2 parents 54f70f5 + 7e682f7 commit d0d6ab5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
22 changes: 21 additions & 1 deletion fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
char *tmp_end, *value;
char delim;
bool got_ip = false;
bool got_version = false;
unsigned short port = 0;
struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr;

Expand Down Expand Up @@ -1874,24 +1875,35 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
pr_warn("CIFS: server netbiosname longer than 15 truncated.\n");
break;
case Opt_ver:
/* version of mount userspace tools, not dialect */
string = match_strdup(args);
if (string == NULL)
goto out_nomem;

/* If interface changes in mount.cifs bump to new ver */
if (strncasecmp(string, "1", 1) == 0) {
if (strlen(string) > 1) {
pr_warn("Bad mount helper ver=%s. Did "
"you want SMB1 (CIFS) dialect "
"and mean to type vers=1.0 "
"instead?\n", string);
goto cifs_parse_mount_err;
}
/* This is the default */
break;
}
/* For all other value, error */
pr_warn("CIFS: Invalid version specified\n");
pr_warn("CIFS: Invalid mount helper version specified\n");
goto cifs_parse_mount_err;
case Opt_vers:
/* protocol version (dialect) */
string = match_strdup(args);
if (string == NULL)
goto out_nomem;

if (cifs_parse_smb_version(string, vol) != 0)
goto cifs_parse_mount_err;
got_version = true;
break;
case Opt_sec:
string = match_strdup(args);
Expand Down Expand Up @@ -1973,6 +1985,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
else if (override_gid == 1)
pr_notice("CIFS: ignoring forcegid mount option specified with no gid= option.\n");

if (got_version == false)
pr_warn("No dialect specified on mount. Default has changed to "
"a more secure dialect, SMB3 (vers=3.0), from CIFS "
"(SMB1). To use the less secure SMB1 dialect to access "
"old servers which do not support SMB3 specify vers=1.0"
" on mount. For somewhat newer servers such as Windows "
"7 try vers=2.1.\n");

kfree(mountdata_copy);
return 0;

Expand Down
7 changes: 6 additions & 1 deletion fs/cifs/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,12 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
* No tcon so can't do
* cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);
*/
if (rc != 0)
if (rc == -EOPNOTSUPP) {
cifs_dbg(VFS, "Dialect not supported by server. Consider "
"specifying vers=1.0 or vers=2.1 on mount for accessing"
" older servers\n");
goto neg_exit;
} else if (rc != 0)
goto neg_exit;

cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode);
Expand Down

0 comments on commit d0d6ab5

Please sign in to comment.