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

Merge tag 'v7.1-rc1-part3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - Four bug fixes: OOB read in ioctl query info, 3 ACL fixes

 - SMB1 Unix extensions mount fix

 - Four crypto improvements: move to AES-CMAC library, simpler and faster

 - Remove drop_dir_cache to avoid potential crash, and move to /procfs

 - Seven SMB3.1.1 compression fixes

* tag 'v7.1-rc1-part3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  smb: client: Drop 'allocate_crypto' arg from smb*_calc_signature()
  smb: client: Make generate_key() return void
  smb: client: Remove obsolete cmac(aes) allocation
  smb: client: Use AES-CMAC library for SMB3 signature calculation
  smb: common: add SMB3_COMPRESS_MAX_ALGS
  smb: client: compress: add code docs to lz77.c
  smb: client: compress: LZ77 optimizations
  smb: client: compress: increase LZ77_MATCH_MAX_DIST
  smb: client: compress: fix counting in LZ77 match finding
  smb: client: compress: fix buffer overrun in lz77_compress()
  smb: client: scope end_of_dacl to CIFS_DEBUG2 use in parse_dacl
  smb: client: fix (remove) drop_dir_cache module parameter
  smb: client: require a full NFS mode SID before reading mode bits
  smb: client: validate the whole DACL before rewriting it in cifsacl
  smb: client: fix OOB read in smb2_ioctl_query_info QUERY_INFO path
  cifs: update internal module version number
  smb: client: compress: fix bad encoding on last LZ77 flag
  smb: client: fix dir separator in SMB1 UNIX mounts
parents e728258d a83307f3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,11 +5,11 @@ config CIFS
	select NLS
	select NLS_UCS2_UTILS
	select CRYPTO
	select CRYPTO_CMAC
	select CRYPTO_AEAD2
	select CRYPTO_CCM
	select CRYPTO_GCM
	select CRYPTO_AES
	select CRYPTO_LIB_AES_CBC_MACS
	select CRYPTO_LIB_ARC4
	select CRYPTO_LIB_MD5
	select CRYPTO_LIB_SHA256
+3 −2
Original line number Diff line number Diff line
@@ -593,7 +593,7 @@ void close_all_cached_dirs(struct cifs_sb_info *cifs_sb)
 * Invalidate all cached dirs when a TCON has been reset
 * due to a session loss.
 */
void invalidate_all_cached_dirs(struct cifs_tcon *tcon)
void invalidate_all_cached_dirs(struct cifs_tcon *tcon, bool sync)
{
	struct cached_fids *cfids = tcon->cfids;
	struct cached_fid *cfid, *q;
@@ -625,6 +625,7 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon)

	/* run laundromat unconditionally now as there might have been previously queued work */
	mod_delayed_work(cfid_put_wq, &cfids->laundromat_work, 0);
	if (sync)
		flush_delayed_work(&cfids->laundromat_work);
}

+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ void close_cached_dir(struct cached_fid *cfid);
void drop_cached_dir_by_name(const unsigned int xid, struct cifs_tcon *tcon,
			     const char *name, struct cifs_sb_info *cifs_sb);
void close_all_cached_dirs(struct cifs_sb_info *cifs_sb);
void invalidate_all_cached_dirs(struct cifs_tcon *tcon);
void invalidate_all_cached_dirs(struct cifs_tcon *tcon, bool sync);
bool cached_dir_lease_break(struct cifs_tcon *tcon, __u8 lease_key[16]);

#endif			/* _CACHED_DIR_H */
+53 −3
Original line number Diff line number Diff line
@@ -306,6 +306,9 @@ static int cifs_debug_dirs_proc_show(struct seq_file *m, void *v)
	LIST_HEAD(entry);

	seq_puts(m, "# Version:1\n");
#ifdef CONFIG_CIFS_DEBUG
	seq_puts(m, "# Write 0 to this file to drop all cached directory entries\n");
#endif /* CONFIG_CIFS_DEBUG */
	seq_puts(m, "# Format:\n");
	seq_puts(m, "# <tree id> <sess id> <persistent fid> <lease-key> <path>\n");

@@ -353,6 +356,51 @@ static int cifs_debug_dirs_proc_show(struct seq_file *m, void *v)
	return 0;
}

#ifdef CONFIG_CIFS_DEBUG
static int cifs_debug_dirs_proc_open(struct inode *inode, struct file *file)
{
	return single_open(file, cifs_debug_dirs_proc_show, NULL);
}

/* Drop all cached directory entries across all CIFS mounts. */
static ssize_t cifs_debug_dirs_proc_write(struct file *file, const char __user *buffer,
					  size_t count, loff_t *ppos)
{
	int rc, v;

	rc = kstrtoint_from_user(buffer, count, 10, &v);
	if (rc)
		return rc;

	if (v == 0) {
		struct TCP_Server_Info *server;
		struct cifs_ses *ses;
		struct cifs_tcon *tcon;

		spin_lock(&cifs_tcp_ses_lock);
		list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
			list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
				if (cifs_ses_exiting(ses))
					continue;
				list_for_each_entry(tcon, &ses->tcon_list, tcon_list)
					invalidate_all_cached_dirs(tcon, false);
			}
		}
		spin_unlock(&cifs_tcp_ses_lock);
	}

	return count;
}

static const struct proc_ops cifs_debug_dirs_proc_ops = {
	.proc_open	= cifs_debug_dirs_proc_open,
	.proc_read	= seq_read,
	.proc_lseek	= seq_lseek,
	.proc_release	= single_release,
	.proc_write	= cifs_debug_dirs_proc_write,
};
#endif /* CONFIG_CIFS_DEBUG */

static __always_inline const char *compression_alg_str(__le16 alg)
{
	switch (alg) {
@@ -885,9 +933,11 @@ cifs_proc_init(void)
	proc_create_single("open_files", 0400, proc_fs_cifs,
			cifs_debug_files_proc_show);

	proc_create_single("open_dirs", 0400, proc_fs_cifs,
			cifs_debug_dirs_proc_show);

#ifdef CONFIG_CIFS_DEBUG
	proc_create("open_dirs", 0600, proc_fs_cifs, &cifs_debug_dirs_proc_ops);
#else /* CONFIG_CIFS_DEBUG */
	proc_create_single("open_dirs", 0400, proc_fs_cifs, cifs_debug_dirs_proc_show);
#endif /* !CONFIG_CIFS_DEBUG */
	proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_ops);
	proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_ops);
	proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_ops);
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 */
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/unaligned.h>
#include "cifs_fs_sb.h"
#include "cifs_unicode.h"
#include "cifsglob.h"
Loading