Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6facac1a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull CIFS fixes from Steve French:
 "This includes a set of misc.  cifs fixes (most importantly some byte
  range lock related write fixes from Pavel, and some ACL and idmap
  related fixes from Jeff) but also includes the SMB2.02 dialect
  enablement, and a key fix for SMB3 mounts.

  Default authentication upgraded to ntlmv2 for cifs (it was already
  ntlmv2 for smb2)"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6: (43 commits)
  CIFS: Fix write after setting a read lock for read oplock files
  cifs: parse the device name into UNC and prepath
  cifs: fix up handling of prefixpath= option
  cifs: clean up handling of unc= option
  cifs: fix SID binary to string conversion
  fix "disabling echoes and oplocks" on SMB2 mounts
  Do not send SMB2 signatures for SMB3 frames
  cifs: deal with id_to_sid embedded sid reply corner case
  cifs: fix hardcoded default security descriptor length
  cifs: extra sanity checking for cifs.idmap keys
  cifs: avoid extra allocation for small cifs.idmap keys
  cifs: simplify id_to_sid and sid_to_id mapping code
  CIFS: Fix possible data coherency problem after oplock break to None
  CIFS: Do not permit write to a range mandatory locked with a read lock
  cifs: rename cifs_readdir_lookup to cifs_prime_dcache and make it void return
  cifs: Add CONFIG_CIFS_DEBUG and rename use of CIFS_DEBUG
  cifs: Make CIFS_DEBUG possible to undefine
  SMB3 mounts fail with access denied to some servers
  cifs: Remove unused cEVENT macro
  cifs: always zero out smb_vol before parsing options
  ...
parents 3f1c64f4 c299dd0e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -122,9 +122,17 @@ config CIFS_ACL
	    Allows fetching CIFS/NTFS ACL from the server.  The DACL blob
	    is handed over to the application/caller.

config CIFS_DEBUG
	bool "Enable CIFS debugging routines"
	default y
	depends on CIFS
	help
	   Enabling this option adds helpful debugging messages to
	   the cifs code which increases the size of the cifs module.
	   If unsure, say Y.
config CIFS_DEBUG2
	bool "Enable additional CIFS debugging routines"
	depends on CIFS
	depends on CIFS_DEBUG
	help
	   Enabling this option adds a few more debugging routines
	   to the cifs code which slightly increases the size of
+41 −31
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
*/
#define CIFS_DEBUG		/* BB temporary */

#ifndef _H_CIFS_DEBUG
#define _H_CIFS_DEBUG
@@ -37,49 +36,43 @@ void dump_smb(void *, int);
#define CIFS_RC		0x02
#define CIFS_TIMER	0x04

extern int cifsFYI;
extern int cifsERROR;

/*
 *	debug ON
 *	--------
 */
#ifdef CIFS_DEBUG
#ifdef CONFIG_CIFS_DEBUG

/* information message: e.g., configuration, major event */
extern int cifsFYI;
#define cifsfyi(fmt, arg...)						\
#define cifsfyi(fmt, ...)						\
do {									\
	if (cifsFYI & CIFS_INFO)					\
		printk(KERN_DEBUG "%s: " fmt "\n", __FILE__, ##arg);	\
		printk(KERN_DEBUG "%s: " fmt "\n",			\
		       __FILE__, ##__VA_ARGS__);			\
} while (0)

#define cFYI(set, fmt, arg...)			\
#define cFYI(set, fmt, ...)						\
do {									\
	if (set)							\
		cifsfyi(fmt, ##arg);		\
		cifsfyi(fmt, ##__VA_ARGS__);				\
} while (0)

#define cifswarn(fmt, arg...)			\
	printk(KERN_WARNING fmt "\n", ##arg)

/* debug event message: */
extern int cifsERROR;

#define cEVENT(fmt, arg...)						\
do {									\
	if (cifsERROR)							\
		printk(KERN_EVENT "%s: " fmt "\n", __FILE__, ##arg);	\
} while (0)
#define cifswarn(fmt, ...)						\
	printk(KERN_WARNING fmt "\n", ##__VA_ARGS__)

/* error event message: e.g., i/o error */
#define cifserror(fmt, arg...)					\
#define cifserror(fmt, ...)						\
do {									\
	if (cifsERROR)							\
		printk(KERN_ERR "CIFS VFS: " fmt "\n", ##arg);	\
		printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);	\
} while (0)

#define cERROR(set, fmt, arg...)		\
#define cERROR(set, fmt, ...)						\
do {									\
	if (set)							\
		cifserror(fmt, ##arg);		\
		cifserror(fmt, ##__VA_ARGS__);				\
} while (0)

/*
@@ -87,10 +80,27 @@ do { \
 *	---------
 */
#else		/* _CIFS_DEBUG */
#define cERROR(set, fmt, arg...)
#define cEVENT(fmt, arg...)
#define cFYI(set, fmt, arg...)
#define cifserror(fmt, arg...)
#define cifsfyi(fmt, ...)						\
do {									\
	if (0)								\
		printk(KERN_DEBUG "%s: " fmt "\n",			\
		       __FILE__, ##__VA_ARGS__);			\
} while (0)
#define cFYI(set, fmt, ...)						\
do {									\
	if (0 && set)							\
		cifsfyi(fmt, ##__VA_ARGS__);				\
} while (0)
#define cifserror(fmt, ...)						\
do {									\
	if (0)								\
		printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);	\
} while (0)
#define cERROR(set, fmt, ...)						\
do {									\
	if (0 && set)							\
		cifserror(fmt, ##__VA_ARGS__);				\
} while (0)
#endif		/* _CIFS_DEBUG */

#endif				/* _H_CIFS_DEBUG */
+227 −519

File changed.

Preview size limit exceeded, changes collapsed.

+32 −34
Original line number Diff line number Diff line
@@ -23,11 +23,8 @@
#define _CIFSACL_H


#define NUM_AUTHS 6 /* number of authority fields */
#define NUM_SUBAUTHS 5 /* number of sub authority fields */
#define NUM_WK_SIDS 7 /* number of well known sids */
#define SIDNAMELENGTH 20 /* long enough for the ones we care about */
#define DEFSECDESCLEN 192 /* sec desc len contaiting a dacl with three aces */
#define NUM_AUTHS (6)	/* number of authority fields */
#define SID_MAX_SUB_AUTHORITIES (15) /* max number of sub authority fields */

#define READ_BIT        0x4
#define WRITE_BIT       0x2
@@ -41,12 +38,32 @@

#define SIDOWNER 1
#define SIDGROUP 2
#define SIDLEN 150 /* S- 1 revision- 6 authorities- max 5 sub authorities */

#define SID_ID_MAPPED 0
#define SID_ID_PENDING 1
#define SID_MAP_EXPIRE (3600 * HZ) /* map entry expires after one hour */
#define SID_MAP_RETRY (300 * HZ)   /* wait 5 minutes for next attempt to map */
/*
 * Security Descriptor length containing DACL with 3 ACEs (one each for
 * owner, group and world).
 */
#define DEFAULT_SEC_DESC_LEN (sizeof(struct cifs_ntsd) + \
			      sizeof(struct cifs_acl) + \
			      (sizeof(struct cifs_ace) * 3))

/*
 * Maximum size of a string representation of a SID:
 *
 * The fields are unsigned values in decimal. So:
 *
 * u8:  max 3 bytes in decimal
 * u32: max 10 bytes in decimal
 *
 * "S-" + 3 bytes for version field + 15 for authority field + NULL terminator
 *
 * For authority field, max is when all 6 values are non-zero and it must be
 * represented in hex. So "-0x" + 12 hex digits.
 *
 * Add 11 bytes for each subauthority field (10 bytes each + 1 for '-')
 */
#define SID_STRING_BASE_SIZE (2 + 3 + 15 + 1)
#define SID_STRING_SUBAUTH_SIZE (11) /* size of a single subauth string */

struct cifs_ntsd {
	__le16 revision; /* revision level */
@@ -60,10 +77,13 @@ struct cifs_ntsd {
struct cifs_sid {
	__u8 revision; /* revision level */
	__u8 num_subauth;
	__u8 authority[6];
	__le32 sub_auth[5]; /* sub_auth[num_subauth] */
	__u8 authority[NUM_AUTHS];
	__le32 sub_auth[SID_MAX_SUB_AUTHORITIES]; /* sub_auth[num_subauth] */
} __attribute__((packed));

/* size of a struct cifs_sid, sans sub_auth array */
#define CIFS_SID_BASE_SIZE (1 + 1 + NUM_AUTHS)

struct cifs_acl {
	__le16 revision; /* revision level */
	__le16 size;
@@ -78,26 +98,4 @@ struct cifs_ace {
	struct cifs_sid sid; /* ie UUID of user or group who gets these perms */
} __attribute__((packed));

struct cifs_wksid {
	struct cifs_sid cifssid;
	char sidname[SIDNAMELENGTH];
} __attribute__((packed));

struct cifs_sid_id {
	unsigned int refcount; /* increment with spinlock, decrement without */
	unsigned long id;
	unsigned long time;
	unsigned long state;
	char *sidstr;
	struct rb_node rbnode;
	struct cifs_sid sid;
};

#ifdef __KERNEL__
extern struct key_type cifs_idmap_key_type;
extern const struct cred *root_cred;
#endif /* KERNEL */

extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *);

#endif /* _CIFSACL_H */
+8 −9
Original line number Diff line number Diff line
@@ -64,24 +64,23 @@ unsigned int global_secflags = CIFSSEC_DEF;
unsigned int sign_CIFS_PDUs = 1;
static const struct super_operations cifs_super_ops;
unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
module_param(CIFSMaxBufSize, int, 0);
module_param(CIFSMaxBufSize, uint, 0);
MODULE_PARM_DESC(CIFSMaxBufSize, "Network buffer size (not including header). "
				 "Default: 16384 Range: 8192 to 130048");
unsigned int cifs_min_rcv = CIFS_MIN_RCV_POOL;
module_param(cifs_min_rcv, int, 0);
module_param(cifs_min_rcv, uint, 0);
MODULE_PARM_DESC(cifs_min_rcv, "Network buffers in pool. Default: 4 Range: "
				"1 to 64");
unsigned int cifs_min_small = 30;
module_param(cifs_min_small, int, 0);
module_param(cifs_min_small, uint, 0);
MODULE_PARM_DESC(cifs_min_small, "Small network buffers in pool. Default: 30 "
				 "Range: 2 to 256");
unsigned int cifs_max_pending = CIFS_MAX_REQ;
module_param(cifs_max_pending, int, 0444);
module_param(cifs_max_pending, uint, 0444);
MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server. "
				   "Default: 32767 Range: 2 to 32767.");
module_param(enable_oplocks, bool, 0644);
MODULE_PARM_DESC(enable_oplocks, "Enable or disable oplocks (bool). Default:"
				 "y/Y/1");
MODULE_PARM_DESC(enable_oplocks, "Enable or disable oplocks. Default: y/Y/1");

extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp;
@@ -230,6 +229,7 @@ cifs_alloc_inode(struct super_block *sb)
	cifs_set_oplock_level(cifs_inode, 0);
	cifs_inode->delete_pending = false;
	cifs_inode->invalid_mapping = false;
	cifs_inode->leave_pages_clean = false;
	cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
	cifs_inode->server_eof = 0;
	cifs_inode->uniqueid = 0;
@@ -540,7 +540,7 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
	char *s, *p;
	char sep;

	full_path = build_path_to_root(vol, cifs_sb,
	full_path = cifs_build_path_to_root(vol, cifs_sb,
					    cifs_sb_master_tcon(cifs_sb));
	if (full_path == NULL)
		return ERR_PTR(-ENOMEM);
@@ -1205,7 +1205,6 @@ exit_cifs(void)
	unregister_filesystem(&cifs_fs_type);
	cifs_dfs_release_automount_timer();
#ifdef CONFIG_CIFS_ACL
	cifs_destroy_idmaptrees();
	exit_cifs_idmap();
#endif
#ifdef CONFIG_CIFS_UPCALL
Loading