Commit d31e3792 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag '6.5-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:
 "Four small SMB3 client fixes:

   - two reconnect fixes (to address the case where non-default
     iocharset gets incorrectly overridden at reconnect with the
     default charset)

   - fix for NTLMSSP_AUTH request setting a flag incorrectly)

   - Add missing check for invalid tlink (tree connection) in ioctl"

* tag '6.5-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: add missing return value check for cifs_sb_tlink
  smb3: do not set NTLMSSP_VERSION flag for negotiate not auth request
  cifs: fix charset issue in reconnection
  fs/nls: make load_nls() take a const parameter
parents b88e123c a171eb5c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -272,7 +272,7 @@ int unregister_nls(struct nls_table * nls)
	return -EINVAL;
}

static struct nls_table *find_nls(char *charset)
static struct nls_table *find_nls(const char *charset)
{
	struct nls_table *nls;
	spin_lock(&nls_lock);
@@ -288,7 +288,7 @@ static struct nls_table *find_nls(char *charset)
	return nls;
}

struct nls_table *load_nls(char *charset)
struct nls_table *load_nls(const char *charset)
{
	return try_then_request_module(find_nls(charset), "nls_%s", charset);
}
+1 −0
Original line number Diff line number Diff line
@@ -1062,6 +1062,7 @@ struct cifs_ses {
	unsigned long chans_need_reconnect;
	/* ========= end: protected by chan_lock ======== */
	struct cifs_ses *dfs_root_ses;
	struct nls_table *local_nls;
};

static inline bool
+1 −2
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
	}
	spin_unlock(&server->srv_lock);

	nls_codepage = load_nls_default();
	nls_codepage = ses->local_nls;

	/*
	 * need to prevent multiple threads trying to simultaneously
@@ -200,7 +200,6 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
		rc = -EAGAIN;
	}

	unload_nls(nls_codepage);
	return rc;
}

+5 −0
Original line number Diff line number Diff line
@@ -1842,6 +1842,10 @@ static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx)
			    CIFS_MAX_PASSWORD_LEN))
			return 0;
	}

	if (strcmp(ctx->local_nls->charset, ses->local_nls->charset))
		return 0;

	return 1;
}

@@ -2286,6 +2290,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)

	ses->sectype = ctx->sectype;
	ses->sign = ctx->sign;
	ses->local_nls = load_nls(ctx->local_nls->charset);

	/* add server as first channel */
	spin_lock(&ses->chan_lock);
+5 −0
Original line number Diff line number Diff line
@@ -478,6 +478,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
			}
			cifs_sb = CIFS_SB(inode->i_sb);
			tlink = cifs_sb_tlink(cifs_sb);
			if (IS_ERR(tlink)) {
				rc = PTR_ERR(tlink);
				break;
			}

			tcon = tlink_tcon(tlink);
			rc = cifs_dump_full_key(tcon, (void __user *)arg);
			cifs_put_tlink(tlink);
Loading