View | Details | Raw Unified | Return to bug 9444
Collapse All | Expand All

(-)sources/3.8/cifsacl.c (-15 / +32 lines)
Lines 266-273 Link Here
266
	struct key *sidkey;
266
	struct key *sidkey;
267
	char *sidstr;
267
	char *sidstr;
268
	const struct cred *saved_cred;
268
	const struct cred *saved_cred;
269
	uid_t fuid = cifs_sb->mnt_uid;
269
	kuid_t fuid = cifs_sb->mnt_uid;
270
	gid_t fgid = cifs_sb->mnt_gid;
270
	kgid_t fgid = cifs_sb->mnt_gid;
271
271
272
	/*
272
	/*
273
	 * If we have too many subauthorities, then something is really wrong.
273
	 * If we have too many subauthorities, then something is really wrong.
Lines 297-302 Link Here
297
	 * probably a safe assumption but might be better to check based on
297
	 * probably a safe assumption but might be better to check based on
298
	 * sidtype.
298
	 * sidtype.
299
	 */
299
	 */
300
	BUILD_BUG_ON(sizeof(uid_t) != sizeof(gid_t));
300
	if (sidkey->datalen != sizeof(uid_t)) {
301
	if (sidkey->datalen != sizeof(uid_t)) {
301
		rc = -EIO;
302
		rc = -EIO;
302
		cFYI(1, "%s: Downcall contained malformed key "
303
		cFYI(1, "%s: Downcall contained malformed key "
Lines 305-314 Link Here
305
		goto out_key_put;
306
		goto out_key_put;
306
	}
307
	}
307
308
308
	if (sidtype == SIDOWNER)
309
	if (sidtype == SIDOWNER) {
309
		memcpy(&fuid, &sidkey->payload.value, sizeof(uid_t));
310
		kuid_t uid;
310
	else
311
		uid_t id;
311
		memcpy(&fgid, &sidkey->payload.value, sizeof(gid_t));
312
		memcpy(&id, &sidkey->payload.value, sizeof(uid_t));
313
		uid = make_kuid(&init_user_ns, id);
314
		if (uid_valid(uid))
315
			fuid = uid;
316
	} else {
317
		kgid_t gid;
318
		gid_t id;
319
		memcpy(&id, &sidkey->payload.value, sizeof(gid_t));
320
		gid = make_kgid(&init_user_ns, id);
321
		if (gid_valid(gid))
322
			fgid = gid;
323
	}
312
324
313
out_key_put:
325
out_key_put:
314
	key_put(sidkey);
326
	key_put(sidkey);
Lines 346-352 Link Here
346
	if (!cred)
358
	if (!cred)
347
		return -ENOMEM;
359
		return -ENOMEM;
348
360
349
	keyring = keyring_alloc(".cifs_idmap", 0, 0, cred,
361
	keyring = keyring_alloc(".cifs_idmap",
362
				GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred,
350
				(KEY_POS_ALL & ~KEY_POS_SETATTR) |
363
				(KEY_POS_ALL & ~KEY_POS_SETATTR) |
351
				KEY_USR_VIEW | KEY_USR_READ,
364
				KEY_USR_VIEW | KEY_USR_READ,
352
				KEY_ALLOC_NOT_IN_QUOTA, NULL);
365
				KEY_ALLOC_NOT_IN_QUOTA, NULL);
Lines 774-780 Link Here
774
787
775
/* Convert permission bits from mode to equivalent CIFS ACL */
788
/* Convert permission bits from mode to equivalent CIFS ACL */
776
static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
789
static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
777
	__u32 secdesclen, __u64 nmode, uid_t uid, gid_t gid, int *aclflag)
790
	__u32 secdesclen, __u64 nmode, kuid_t uid, kgid_t gid, int *aclflag)
778
{
791
{
779
	int rc = 0;
792
	int rc = 0;
780
	__u32 dacloffset;
793
	__u32 dacloffset;
Lines 806-822 Link Here
806
		*aclflag = CIFS_ACL_DACL;
819
		*aclflag = CIFS_ACL_DACL;
807
	} else {
820
	} else {
808
		memcpy(pnntsd, pntsd, secdesclen);
821
		memcpy(pnntsd, pntsd, secdesclen);
809
		if (uid != NO_CHANGE_32) { /* chown */
822
		if (uid_valid(uid)) { /* chown */
823
			uid_t id;
810
			owner_sid_ptr = (struct cifs_sid *)((char *)pnntsd +
824
			owner_sid_ptr = (struct cifs_sid *)((char *)pnntsd +
811
					le32_to_cpu(pnntsd->osidoffset));
825
					le32_to_cpu(pnntsd->osidoffset));
812
			nowner_sid_ptr = kmalloc(sizeof(struct cifs_sid),
826
			nowner_sid_ptr = kmalloc(sizeof(struct cifs_sid),
813
								GFP_KERNEL);
827
								GFP_KERNEL);
814
			if (!nowner_sid_ptr)
828
			if (!nowner_sid_ptr)
815
				return -ENOMEM;
829
				return -ENOMEM;
816
			rc = id_to_sid(uid, SIDOWNER, nowner_sid_ptr);
830
			id = from_kuid(&init_user_ns, uid);
831
			rc = id_to_sid(id, SIDOWNER, nowner_sid_ptr);
817
			if (rc) {
832
			if (rc) {
818
				cFYI(1, "%s: Mapping error %d for owner id %d",
833
				cFYI(1, "%s: Mapping error %d for owner id %d",
819
						__func__, rc, uid);
834
						__func__, rc, id);
820
				kfree(nowner_sid_ptr);
835
				kfree(nowner_sid_ptr);
821
				return rc;
836
				return rc;
822
			}
837
			}
Lines 824-840 Link Here
824
			kfree(nowner_sid_ptr);
839
			kfree(nowner_sid_ptr);
825
			*aclflag = CIFS_ACL_OWNER;
840
			*aclflag = CIFS_ACL_OWNER;
826
		}
841
		}
827
		if (gid != NO_CHANGE_32) { /* chgrp */
842
		if (gid_valid(gid)) { /* chgrp */
843
			gid_t id;
828
			group_sid_ptr = (struct cifs_sid *)((char *)pnntsd +
844
			group_sid_ptr = (struct cifs_sid *)((char *)pnntsd +
829
					le32_to_cpu(pnntsd->gsidoffset));
845
					le32_to_cpu(pnntsd->gsidoffset));
830
			ngroup_sid_ptr = kmalloc(sizeof(struct cifs_sid),
846
			ngroup_sid_ptr = kmalloc(sizeof(struct cifs_sid),
831
								GFP_KERNEL);
847
								GFP_KERNEL);
832
			if (!ngroup_sid_ptr)
848
			if (!ngroup_sid_ptr)
833
				return -ENOMEM;
849
				return -ENOMEM;
834
			rc = id_to_sid(gid, SIDGROUP, ngroup_sid_ptr);
850
			id = from_kgid(&init_user_ns, gid);
851
			rc = id_to_sid(id, SIDGROUP, ngroup_sid_ptr);
835
			if (rc) {
852
			if (rc) {
836
				cFYI(1, "%s: Mapping error %d for group id %d",
853
				cFYI(1, "%s: Mapping error %d for group id %d",
837
						__func__, rc, gid);
854
						__func__, rc, id);
838
				kfree(ngroup_sid_ptr);
855
				kfree(ngroup_sid_ptr);
839
				return rc;
856
				return rc;
840
			}
857
			}
Lines 1004-1010 Link Here
1004
/* Convert mode bits to an ACL so we can update the ACL on the server */
1021
/* Convert mode bits to an ACL so we can update the ACL on the server */
1005
int
1022
int
1006
id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
1023
id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
1007
			uid_t uid, gid_t gid)
1024
			kuid_t uid, kgid_t gid)
1008
{
1025
{
1009
	int rc = 0;
1026
	int rc = 0;
1010
	int aclflag = CIFS_ACL_DACL; /* default flag to set */
1027
	int aclflag = CIFS_ACL_DACL; /* default flag to set */
(-)sources/3.8/cifs_dfs_ref.c (-1 / +3 lines)
Lines 18-23 Link Here
18
#include <linux/slab.h>
18
#include <linux/slab.h>
19
#include <linux/vfs.h>
19
#include <linux/vfs.h>
20
#include <linux/fs.h>
20
#include <linux/fs.h>
21
#include <linux/inet.h>
21
#include "cifsglob.h"
22
#include "cifsglob.h"
22
#include "cifsproto.h"
23
#include "cifsproto.h"
23
#include "cifsfs.h"
24
#include "cifsfs.h"
Lines 150-156 Link Here
150
	 * assuming that we have 'unc=' and 'ip=' in
151
	 * assuming that we have 'unc=' and 'ip=' in
151
	 * the original sb_mountdata
152
	 * the original sb_mountdata
152
	 */
153
	 */
153
	md_len = strlen(sb_mountdata) + rc + strlen(ref->node_name) + 12;
154
	md_len = strlen(sb_mountdata) + rc + strlen(ref->node_name) + 12 +
155
			INET6_ADDRSTRLEN;
154
	mountdata = kzalloc(md_len+1, GFP_KERNEL);
156
	mountdata = kzalloc(md_len+1, GFP_KERNEL);
155
	if (mountdata == NULL) {
157
	if (mountdata == NULL) {
156
		rc = -ENOMEM;
158
		rc = -ENOMEM;
(-)sources/3.8/cifsfs.c (-7 / +14 lines)
Lines 399-411 Link Here
399
				   (int)(srcaddr->sa_family));
399
				   (int)(srcaddr->sa_family));
400
	}
400
	}
401
401
402
	seq_printf(s, ",uid=%u", cifs_sb->mnt_uid);
402
	seq_printf(s, ",uid=%u",
403
		   from_kuid_munged(&init_user_ns, cifs_sb->mnt_uid));
403
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)
404
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)
404
		seq_printf(s, ",forceuid");
405
		seq_printf(s, ",forceuid");
405
	else
406
	else
406
		seq_printf(s, ",noforceuid");
407
		seq_printf(s, ",noforceuid");
407
408
408
	seq_printf(s, ",gid=%u", cifs_sb->mnt_gid);
409
	seq_printf(s, ",gid=%u",
410
		   from_kgid_munged(&init_user_ns, cifs_sb->mnt_gid));
409
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)
411
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)
410
		seq_printf(s, ",forcegid");
412
		seq_printf(s, ",forcegid");
411
	else
413
	else
Lines 463-471 Link Here
463
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
465
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
464
		seq_printf(s, ",noperm");
466
		seq_printf(s, ",noperm");
465
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID)
467
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID)
466
		seq_printf(s, ",backupuid=%u", cifs_sb->mnt_backupuid);
468
		seq_printf(s, ",backupuid=%u",
469
			   from_kuid_munged(&init_user_ns,
470
					    cifs_sb->mnt_backupuid));
467
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID)
471
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID)
468
		seq_printf(s, ",backupgid=%u", cifs_sb->mnt_backupgid);
472
		seq_printf(s, ",backupgid=%u",
473
			   from_kgid_munged(&init_user_ns,
474
					    cifs_sb->mnt_backupgid));
469
475
470
	seq_printf(s, ",rsize=%u", cifs_sb->rsize);
476
	seq_printf(s, ",rsize=%u", cifs_sb->rsize);
471
	seq_printf(s, ",wsize=%u", cifs_sb->wsize);
477
	seq_printf(s, ",wsize=%u", cifs_sb->wsize);
Lines 709-715 Link Here
709
static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
715
static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
710
				   unsigned long nr_segs, loff_t pos)
716
				   unsigned long nr_segs, loff_t pos)
711
{
717
{
712
	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
718
	struct inode *inode = file_inode(iocb->ki_filp);
713
	ssize_t written;
719
	ssize_t written;
714
	int rc;
720
	int rc;
715
721
Lines 733-739 Link Here
733
	 */
739
	 */
734
	if (whence != SEEK_SET && whence != SEEK_CUR) {
740
	if (whence != SEEK_SET && whence != SEEK_CUR) {
735
		int rc;
741
		int rc;
736
		struct inode *inode = file->f_path.dentry->d_inode;
742
		struct inode *inode = file_inode(file);
737
743
738
		/*
744
		/*
739
		 * We need to be sure that all dirty pages are written and the
745
		 * We need to be sure that all dirty pages are written and the
Lines 765-771 Link Here
765
{
771
{
766
	/* note that this is called by vfs setlease with lock_flocks held
772
	/* note that this is called by vfs setlease with lock_flocks held
767
	   to protect *lease from going away */
773
	   to protect *lease from going away */
768
	struct inode *inode = file->f_path.dentry->d_inode;
774
	struct inode *inode = file_inode(file);
769
	struct cifsFileInfo *cfile = file->private_data;
775
	struct cifsFileInfo *cfile = file->private_data;
770
776
771
	if (!(S_ISREG(inode->i_mode)))
777
	if (!(S_ISREG(inode->i_mode)))
Lines 798-803 Link Here
798
	.kill_sb = cifs_kill_sb,
804
	.kill_sb = cifs_kill_sb,
799
	/*  .fs_flags */
805
	/*  .fs_flags */
800
};
806
};
807
MODULE_ALIAS_FS("cifs");
801
const struct inode_operations cifs_dir_inode_ops = {
808
const struct inode_operations cifs_dir_inode_ops = {
802
	.create = cifs_create,
809
	.create = cifs_create,
803
	.atomic_open = cifs_atomic_open,
810
	.atomic_open = cifs_atomic_open,
(-)sources/3.8/cifs_fs_sb.h (-4 / +4 lines)
Lines 55-64 Link Here
55
	unsigned int wsize;
55
	unsigned int wsize;
56
	unsigned long actimeo; /* attribute cache timeout (jiffies) */
56
	unsigned long actimeo; /* attribute cache timeout (jiffies) */
57
	atomic_t active;
57
	atomic_t active;
58
	uid_t	mnt_uid;
58
	kuid_t	mnt_uid;
59
	gid_t	mnt_gid;
59
	kgid_t	mnt_gid;
60
	uid_t	mnt_backupuid;
60
	kuid_t	mnt_backupuid;
61
	gid_t	mnt_backupgid;
61
	kgid_t	mnt_backupgid;
62
	umode_t	mnt_file_mode;
62
	umode_t	mnt_file_mode;
63
	umode_t	mnt_dir_mode;
63
	umode_t	mnt_dir_mode;
64
	unsigned int mnt_cifs_flags;
64
	unsigned int mnt_cifs_flags;
(-)sources/3.8/cifsglob.h (-11 / +11 lines)
Lines 400-410 Link Here
400
	char *iocharset;  /* local code page for mapping to and from Unicode */
400
	char *iocharset;  /* local code page for mapping to and from Unicode */
401
	char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */
401
	char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */
402
	char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */
402
	char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */
403
	uid_t cred_uid;
403
	kuid_t cred_uid;
404
	uid_t linux_uid;
404
	kuid_t linux_uid;
405
	gid_t linux_gid;
405
	kgid_t linux_gid;
406
	uid_t backupuid;
406
	kuid_t backupuid;
407
	gid_t backupgid;
407
	kgid_t backupgid;
408
	umode_t file_mode;
408
	umode_t file_mode;
409
	umode_t dir_mode;
409
	umode_t dir_mode;
410
	unsigned secFlg;
410
	unsigned secFlg;
Lines 703-710 Link Here
703
	char *serverNOS;	/* name of network operating system of server */
703
	char *serverNOS;	/* name of network operating system of server */
704
	char *serverDomain;	/* security realm of server */
704
	char *serverDomain;	/* security realm of server */
705
	__u64 Suid;		/* remote smb uid  */
705
	__u64 Suid;		/* remote smb uid  */
706
	uid_t linux_uid;        /* overriding owner of files on the mount */
706
	kuid_t linux_uid;	/* overriding owner of files on the mount */
707
	uid_t cred_uid;		/* owner of credentials */
707
	kuid_t cred_uid;	/* owner of credentials */
708
	unsigned int capabilities;
708
	unsigned int capabilities;
709
	char serverName[SERVER_NAME_LEN_WITH_NULL * 2];	/* BB make bigger for
709
	char serverName[SERVER_NAME_LEN_WITH_NULL * 2];	/* BB make bigger for
710
				TCP names - will ipv6 and sctp addresses fit? */
710
				TCP names - will ipv6 and sctp addresses fit? */
Lines 838-844 Link Here
838
 */
838
 */
839
struct tcon_link {
839
struct tcon_link {
840
	struct rb_node		tl_rbnode;
840
	struct rb_node		tl_rbnode;
841
	uid_t			tl_uid;
841
	kuid_t			tl_uid;
842
	unsigned long		tl_flags;
842
	unsigned long		tl_flags;
843
#define TCON_LINK_MASTER	0
843
#define TCON_LINK_MASTER	0
844
#define TCON_LINK_PENDING	1
844
#define TCON_LINK_PENDING	1
Lines 931-937 Link Here
931
	struct list_head tlist;	/* pointer to next fid owned by tcon */
931
	struct list_head tlist;	/* pointer to next fid owned by tcon */
932
	struct list_head flist;	/* next fid (file instance) for this inode */
932
	struct list_head flist;	/* next fid (file instance) for this inode */
933
	struct cifs_fid_locks *llist;	/* brlocks held by this fid */
933
	struct cifs_fid_locks *llist;	/* brlocks held by this fid */
934
	unsigned int uid;	/* allows finding which FileInfo structure */
934
	kuid_t uid;		/* allows finding which FileInfo structure */
935
	__u32 pid;		/* process id who opened file */
935
	__u32 pid;		/* process id who opened file */
936
	struct cifs_fid fid;	/* file id from remote */
936
	struct cifs_fid fid;	/* file id from remote */
937
	/* BB add lock scope info here if needed */ ;
937
	/* BB add lock scope info here if needed */ ;
Lines 1252-1259 Link Here
1252
	u64		cf_eof;
1252
	u64		cf_eof;
1253
	u64		cf_bytes;
1253
	u64		cf_bytes;
1254
	u64		cf_createtime;
1254
	u64		cf_createtime;
1255
	uid_t		cf_uid;
1255
	kuid_t		cf_uid;
1256
	gid_t		cf_gid;
1256
	kgid_t		cf_gid;
1257
	umode_t		cf_mode;
1257
	umode_t		cf_mode;
1258
	dev_t		cf_rdev;
1258
	dev_t		cf_rdev;
1259
	unsigned int	cf_nlink;
1259
	unsigned int	cf_nlink;
(-)sources/3.8/cifspdu.h (-1 lines)
Lines 285-291 Link Here
285
#define CIFS_NO_HANDLE        0xFFFF
285
#define CIFS_NO_HANDLE        0xFFFF
286
286
287
#define NO_CHANGE_64          0xFFFFFFFFFFFFFFFFULL
287
#define NO_CHANGE_64          0xFFFFFFFFFFFFFFFFULL
288
#define NO_CHANGE_32          0xFFFFFFFFUL
289
288
290
/* IPC$ in ASCII */
289
/* IPC$ in ASCII */
291
#define CIFS_IPC_RESOURCE "\x49\x50\x43\x24"
290
#define CIFS_IPC_RESOURCE "\x49\x50\x43\x24"
(-)sources/3.8/cifsproto.h (-4 / +5 lines)
Lines 46-52 Link Here
46
({								\
46
({								\
47
	unsigned int __xid = _get_xid();				\
47
	unsigned int __xid = _get_xid();				\
48
	cFYI(1, "CIFS VFS: in %s as Xid: %u with uid: %d",	\
48
	cFYI(1, "CIFS VFS: in %s as Xid: %u with uid: %d",	\
49
	     __func__, __xid, current_fsuid());			\
49
	     __func__, __xid,					\
50
	     from_kuid(&init_user_ns, current_fsuid()));	\
50
	__xid;							\
51
	__xid;							\
51
})
52
})
52
53
Lines 161-167 Link Here
161
			      struct cifs_fattr *fattr, struct inode *inode,
162
			      struct cifs_fattr *fattr, struct inode *inode,
162
			      const char *path, const __u16 *pfid);
163
			      const char *path, const __u16 *pfid);
163
extern int id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64,
164
extern int id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64,
164
					uid_t, gid_t);
165
					kuid_t, kgid_t);
165
extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *,
166
extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *,
166
					const char *, u32 *);
167
					const char *, u32 *);
167
extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
168
extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
Lines 304-311 Link Here
304
	__u64	atime;
305
	__u64	atime;
305
	__u64	mtime;
306
	__u64	mtime;
306
	__u64	mode;
307
	__u64	mode;
307
	__u64	uid;
308
	kuid_t	uid;
308
	__u64	gid;
309
	kgid_t	gid;
309
	dev_t	device;
310
	dev_t	device;
310
};
311
};
311
312
(-)sources/3.8/cifssmb.c (-4 / +13 lines)
Lines 1916-1924 Link Here
1916
	} while (rc == -EAGAIN);
1916
	} while (rc == -EAGAIN);
1917
1917
1918
	for (i = 0; i < wdata->nr_pages; i++) {
1918
	for (i = 0; i < wdata->nr_pages; i++) {
1919
		if (rc != 0)
1920
			SetPageError(wdata->pages[i]);
1921
		unlock_page(wdata->pages[i]);
1919
		unlock_page(wdata->pages[i]);
1920
		if (rc != 0) {
1921
			SetPageError(wdata->pages[i]);
1922
			end_page_writeback(wdata->pages[i]);
1923
			page_cache_release(wdata->pages[i]);
1924
		}
1922
	}
1925
	}
1923
1926
1924
	mapping_set_error(inode->i_mapping, rc);
1927
	mapping_set_error(inode->i_mapping, rc);
Lines 5826-5833 Link Here
5826
cifs_fill_unix_set_info(FILE_UNIX_BASIC_INFO *data_offset,
5829
cifs_fill_unix_set_info(FILE_UNIX_BASIC_INFO *data_offset,
5827
			const struct cifs_unix_set_info_args *args)
5830
			const struct cifs_unix_set_info_args *args)
5828
{
5831
{
5832
	u64 uid = NO_CHANGE_64, gid = NO_CHANGE_64;
5829
	u64 mode = args->mode;
5833
	u64 mode = args->mode;
5830
5834
5835
	if (uid_valid(args->uid))
5836
		uid = from_kuid(&init_user_ns, args->uid);
5837
	if (gid_valid(args->gid))
5838
		gid = from_kgid(&init_user_ns, args->gid);
5839
5831
	/*
5840
	/*
5832
	 * Samba server ignores set of file size to zero due to bugs in some
5841
	 * Samba server ignores set of file size to zero due to bugs in some
5833
	 * older clients, but we should be precise - we use SetFileSize to
5842
	 * older clients, but we should be precise - we use SetFileSize to
Lines 5840-5847 Link Here
5840
	data_offset->LastStatusChange = cpu_to_le64(args->ctime);
5849
	data_offset->LastStatusChange = cpu_to_le64(args->ctime);
5841
	data_offset->LastAccessTime = cpu_to_le64(args->atime);
5850
	data_offset->LastAccessTime = cpu_to_le64(args->atime);
5842
	data_offset->LastModificationTime = cpu_to_le64(args->mtime);
5851
	data_offset->LastModificationTime = cpu_to_le64(args->mtime);
5843
	data_offset->Uid = cpu_to_le64(args->uid);
5852
	data_offset->Uid = cpu_to_le64(uid);
5844
	data_offset->Gid = cpu_to_le64(args->gid);
5853
	data_offset->Gid = cpu_to_le64(gid);
5845
	/* better to leave device as zero when it is  */
5854
	/* better to leave device as zero when it is  */
5846
	data_offset->DevMajor = cpu_to_le64(MAJOR(args->device));
5855
	data_offset->DevMajor = cpu_to_le64(MAJOR(args->device));
5847
	data_offset->DevMinor = cpu_to_le64(MINOR(args->device));
5856
	data_offset->DevMinor = cpu_to_le64(MINOR(args->device));
(-)sources/3.8/cifs_spnego.c (-2 / +4 lines)
Lines 149-158 Link Here
149
		goto out;
149
		goto out;
150
150
151
	dp = description + strlen(description);
151
	dp = description + strlen(description);
152
	sprintf(dp, ";uid=0x%x", sesInfo->linux_uid);
152
	sprintf(dp, ";uid=0x%x",
153
		from_kuid_munged(&init_user_ns, sesInfo->linux_uid));
153
154
154
	dp = description + strlen(description);
155
	dp = description + strlen(description);
155
	sprintf(dp, ";creduid=0x%x", sesInfo->cred_uid);
156
	sprintf(dp, ";creduid=0x%x",
157
		from_kuid_munged(&init_user_ns, sesInfo->cred_uid));
156
158
157
	if (sesInfo->user_name) {
159
	if (sesInfo->user_name) {
158
		dp = description + strlen(description);
160
		dp = description + strlen(description);
(-)sources/3.8/connect.c (-36 / +52 lines)
Lines 97-103 Link Here
97
	Opt_user, Opt_pass, Opt_ip,
97
	Opt_user, Opt_pass, Opt_ip,
98
	Opt_unc, Opt_domain,
98
	Opt_unc, Opt_domain,
99
	Opt_srcaddr, Opt_prefixpath,
99
	Opt_srcaddr, Opt_prefixpath,
100
	Opt_iocharset, Opt_sockopt,
100
	Opt_iocharset,
101
	Opt_netbiosname, Opt_servern,
101
	Opt_netbiosname, Opt_servern,
102
	Opt_ver, Opt_vers, Opt_sec, Opt_cache,
102
	Opt_ver, Opt_vers, Opt_sec, Opt_cache,
103
103
Lines 203-209 Link Here
203
	{ Opt_srcaddr, "srcaddr=%s" },
203
	{ Opt_srcaddr, "srcaddr=%s" },
204
	{ Opt_prefixpath, "prefixpath=%s" },
204
	{ Opt_prefixpath, "prefixpath=%s" },
205
	{ Opt_iocharset, "iocharset=%s" },
205
	{ Opt_iocharset, "iocharset=%s" },
206
	{ Opt_sockopt, "sockopt=%s" },
207
	{ Opt_netbiosname, "netbiosname=%s" },
206
	{ Opt_netbiosname, "netbiosname=%s" },
208
	{ Opt_servern, "servern=%s" },
207
	{ Opt_servern, "servern=%s" },
209
	{ Opt_ver, "ver=%s" },
208
	{ Opt_ver, "ver=%s" },
Lines 988-993 Link Here
988
	return rc;
987
	return rc;
989
}
988
}
990
989
990
static int get_option_uid(substring_t args[], kuid_t *result)
991
{
992
	unsigned long value;
993
	kuid_t uid;
994
	int rc;
995
996
	rc = get_option_ul(args, &value);
997
	if (rc)
998
		return rc;
999
1000
	uid = make_kuid(current_user_ns(), value);
1001
	if (!uid_valid(uid))
1002
		return -EINVAL;
1003
1004
	*result = uid;
1005
	return 0;
1006
}
1007
1008
static int get_option_gid(substring_t args[], kgid_t *result)
1009
{
1010
	unsigned long value;
1011
	kgid_t gid;
1012
	int rc;
1013
1014
	rc = get_option_ul(args, &value);
1015
	if (rc)
1016
		return rc;
1017
1018
	gid = make_kgid(current_user_ns(), value);
1019
	if (!gid_valid(gid))
1020
		return -EINVAL;
1021
1022
	*result = gid;
1023
	return 0;
1024
}
991
1025
992
static int cifs_parse_security_flavors(char *value,
1026
static int cifs_parse_security_flavors(char *value,
993
				       struct smb_vol *vol)
1027
				       struct smb_vol *vol)
Lines 997-1003 Link Here
997
1031
998
	switch (match_token(value, cifs_secflavor_tokens, args)) {
1032
	switch (match_token(value, cifs_secflavor_tokens, args)) {
999
	case Opt_sec_krb5:
1033
	case Opt_sec_krb5:
1000
		vol->secFlg |= CIFSSEC_MAY_KRB5;
1034
		vol->secFlg |= CIFSSEC_MAY_KRB5 | CIFSSEC_MAY_SIGN;
1001
		break;
1035
		break;
1002
	case Opt_sec_krb5i:
1036
	case Opt_sec_krb5i:
1003
		vol->secFlg |= CIFSSEC_MAY_KRB5 | CIFSSEC_MUST_SIGN;
1037
		vol->secFlg |= CIFSSEC_MAY_KRB5 | CIFSSEC_MUST_SIGN;
Lines 1429-1475 Link Here
1429
1463
1430
		/* Numeric Values */
1464
		/* Numeric Values */
1431
		case Opt_backupuid:
1465
		case Opt_backupuid:
1432
			if (get_option_ul(args, &option)) {
1466
			if (get_option_uid(args, &vol->backupuid)) {
1433
				cERROR(1, "%s: Invalid backupuid value",
1467
				cERROR(1, "%s: Invalid backupuid value",
1434
					__func__);
1468
					__func__);
1435
				goto cifs_parse_mount_err;
1469
				goto cifs_parse_mount_err;
1436
			}
1470
			}
1437
			vol->backupuid = option;
1438
			vol->backupuid_specified = true;
1471
			vol->backupuid_specified = true;
1439
			break;
1472
			break;
1440
		case Opt_backupgid:
1473
		case Opt_backupgid:
1441
			if (get_option_ul(args, &option)) {
1474
			if (get_option_gid(args, &vol->backupgid)) {
1442
				cERROR(1, "%s: Invalid backupgid value",
1475
				cERROR(1, "%s: Invalid backupgid value",
1443
					__func__);
1476
					__func__);
1444
				goto cifs_parse_mount_err;
1477
				goto cifs_parse_mount_err;
1445
			}
1478
			}
1446
			vol->backupgid = option;
1447
			vol->backupgid_specified = true;
1479
			vol->backupgid_specified = true;
1448
			break;
1480
			break;
1449
		case Opt_uid:
1481
		case Opt_uid:
1450
			if (get_option_ul(args, &option)) {
1482
			if (get_option_uid(args, &vol->linux_uid)) {
1451
				cERROR(1, "%s: Invalid uid value",
1483
				cERROR(1, "%s: Invalid uid value",
1452
					__func__);
1484
					__func__);
1453
				goto cifs_parse_mount_err;
1485
				goto cifs_parse_mount_err;
1454
			}
1486
			}
1455
			vol->linux_uid = option;
1456
			uid_specified = true;
1487
			uid_specified = true;
1457
			break;
1488
			break;
1458
		case Opt_cruid:
1489
		case Opt_cruid:
1459
			if (get_option_ul(args, &option)) {
1490
			if (get_option_uid(args, &vol->cred_uid)) {
1460
				cERROR(1, "%s: Invalid cruid value",
1491
				cERROR(1, "%s: Invalid cruid value",
1461
					__func__);
1492
					__func__);
1462
				goto cifs_parse_mount_err;
1493
				goto cifs_parse_mount_err;
1463
			}
1494
			}
1464
			vol->cred_uid = option;
1465
			break;
1495
			break;
1466
		case Opt_gid:
1496
		case Opt_gid:
1467
			if (get_option_ul(args, &option)) {
1497
			if (get_option_gid(args, &vol->linux_gid)) {
1468
				cERROR(1, "%s: Invalid gid value",
1498
				cERROR(1, "%s: Invalid gid value",
1469
						__func__);
1499
						__func__);
1470
				goto cifs_parse_mount_err;
1500
				goto cifs_parse_mount_err;
1471
			}
1501
			}
1472
			vol->linux_gid = option;
1473
			gid_specified = true;
1502
			gid_specified = true;
1474
			break;
1503
			break;
1475
		case Opt_file_mode:
1504
		case Opt_file_mode:
Lines 1737-1755 Link Here
1737
			 */
1766
			 */
1738
			cFYI(1, "iocharset set to %s", string);
1767
			cFYI(1, "iocharset set to %s", string);
1739
			break;
1768
			break;
1740
		case Opt_sockopt:
1741
			string = match_strdup(args);
1742
			if (string == NULL)
1743
				goto out_nomem;
1744
1745
			if (strnicmp(string, "TCP_NODELAY", 11) == 0) {
1746
				printk(KERN_WARNING "CIFS: the "
1747
					"sockopt=TCP_NODELAY option has been "
1748
					"deprecated and will be removed "
1749
					"in 3.9\n");
1750
				vol->sockopt_tcp_nodelay = 1;
1751
			}
1752
			break;
1753
		case Opt_netbiosname:
1769
		case Opt_netbiosname:
1754
			string = match_strdup(args);
1770
			string = match_strdup(args);
1755
			if (string == NULL)
1771
			if (string == NULL)
Lines 2256-2262 Link Here
2256
{
2272
{
2257
	switch (ses->server->secType) {
2273
	switch (ses->server->secType) {
2258
	case Kerberos:
2274
	case Kerberos:
2259
		if (vol->cred_uid != ses->cred_uid)
2275
		if (!uid_eq(vol->cred_uid, ses->cred_uid))
2260
			return 0;
2276
			return 0;
2261
		break;
2277
		break;
2262
	default:
2278
	default:
Lines 2728-2734 Link Here
2728
	if (new->rsize && new->rsize < old->rsize)
2744
	if (new->rsize && new->rsize < old->rsize)
2729
		return 0;
2745
		return 0;
2730
2746
2731
	if (old->mnt_uid != new->mnt_uid || old->mnt_gid != new->mnt_gid)
2747
	if (!uid_eq(old->mnt_uid, new->mnt_uid) || !gid_eq(old->mnt_gid, new->mnt_gid))
2732
		return 0;
2748
		return 0;
2733
2749
2734
	if (old->mnt_file_mode != new->mnt_file_mode ||
2750
	if (old->mnt_file_mode != new->mnt_file_mode ||
Lines 3321-3328 Link Here
3321
	pos = full_path + unc_len;
3337
	pos = full_path + unc_len;
3322
3338
3323
	if (pplen) {
3339
	if (pplen) {
3324
		*pos++ = CIFS_DIR_SEP(cifs_sb);
3340
		*pos = CIFS_DIR_SEP(cifs_sb);
3325
		strncpy(pos, vol->prepath, pplen);
3341
		strncpy(pos + 1, vol->prepath, pplen);
3326
		pos += pplen;
3342
		pos += pplen;
3327
	}
3343
	}
3328
3344
Lines 3934-3940 Link Here
3934
}
3950
}
3935
3951
3936
static struct cifs_tcon *
3952
static struct cifs_tcon *
3937
cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
3953
cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
3938
{
3954
{
3939
	int rc;
3955
	int rc;
3940
	struct cifs_tcon *master_tcon = cifs_sb_master_tcon(cifs_sb);
3956
	struct cifs_tcon *master_tcon = cifs_sb_master_tcon(cifs_sb);
Lines 4004-4010 Link Here
4004
4020
4005
/* find and return a tlink with given uid */
4021
/* find and return a tlink with given uid */
4006
static struct tcon_link *
4022
static struct tcon_link *
4007
tlink_rb_search(struct rb_root *root, uid_t uid)
4023
tlink_rb_search(struct rb_root *root, kuid_t uid)
4008
{
4024
{
4009
	struct rb_node *node = root->rb_node;
4025
	struct rb_node *node = root->rb_node;
4010
	struct tcon_link *tlink;
4026
	struct tcon_link *tlink;
Lines 4012-4020 Link Here
4012
	while (node) {
4028
	while (node) {
4013
		tlink = rb_entry(node, struct tcon_link, tl_rbnode);
4029
		tlink = rb_entry(node, struct tcon_link, tl_rbnode);
4014
4030
4015
		if (tlink->tl_uid > uid)
4031
		if (uid_gt(tlink->tl_uid, uid))
4016
			node = node->rb_left;
4032
			node = node->rb_left;
4017
		else if (tlink->tl_uid < uid)
4033
		else if (uid_lt(tlink->tl_uid, uid))
4018
			node = node->rb_right;
4034
			node = node->rb_right;
4019
		else
4035
		else
4020
			return tlink;
4036
			return tlink;
Lines 4033-4039 Link Here
4033
		tlink = rb_entry(*new, struct tcon_link, tl_rbnode);
4049
		tlink = rb_entry(*new, struct tcon_link, tl_rbnode);
4034
		parent = *new;
4050
		parent = *new;
4035
4051
4036
		if (tlink->tl_uid > new_tlink->tl_uid)
4052
		if (uid_gt(tlink->tl_uid, new_tlink->tl_uid))
4037
			new = &((*new)->rb_left);
4053
			new = &((*new)->rb_left);
4038
		else
4054
		else
4039
			new = &((*new)->rb_right);
4055
			new = &((*new)->rb_right);
Lines 4063-4069 Link Here
4063
cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
4079
cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
4064
{
4080
{
4065
	int ret;
4081
	int ret;
4066
	uid_t fsuid = current_fsuid();
4082
	kuid_t fsuid = current_fsuid();
4067
	struct tcon_link *tlink, *newtlink;
4083
	struct tcon_link *tlink, *newtlink;
4068
4084
4069
	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER))
4085
	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER))
(-)sources/3.8/dir.c (-9 / +9 lines)
Lines 346-359 Link Here
346
346
347
		*created |= FILE_CREATED;
347
		*created |= FILE_CREATED;
348
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
348
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
349
			args.uid = (__u64) current_fsuid();
349
			args.uid = current_fsuid();
350
			if (inode->i_mode & S_ISGID)
350
			if (inode->i_mode & S_ISGID)
351
				args.gid = (__u64) inode->i_gid;
351
				args.gid = inode->i_gid;
352
			else
352
			else
353
				args.gid = (__u64) current_fsgid();
353
				args.gid = current_fsgid();
354
		} else {
354
		} else {
355
			args.uid = NO_CHANGE_64;
355
			args.uid = INVALID_UID; /* no change */
356
			args.gid = NO_CHANGE_64;
356
			args.gid = INVALID_GID; /* no change */
357
		}
357
		}
358
		CIFSSMBUnixSetFileInfo(xid, tcon, &args, fid->netfid,
358
		CIFSSMBUnixSetFileInfo(xid, tcon, &args, fid->netfid,
359
				       current->tgid);
359
				       current->tgid);
Lines 592-602 Link Here
592
			.device	= device_number,
592
			.device	= device_number,
593
		};
593
		};
594
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
594
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
595
			args.uid = (__u64) current_fsuid();
595
			args.uid = current_fsuid();
596
			args.gid = (__u64) current_fsgid();
596
			args.gid = current_fsgid();
597
		} else {
597
		} else {
598
			args.uid = NO_CHANGE_64;
598
			args.uid = INVALID_UID; /* no change */
599
			args.gid = NO_CHANGE_64;
599
			args.gid = INVALID_GID; /* no change */
600
		}
600
		}
601
		rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, &args,
601
		rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, &args,
602
					    cifs_sb->local_nls,
602
					    cifs_sb->local_nls,
(-)sources/3.8/file.c (-20 / +26 lines)
Lines 43-48 Link Here
43
#include "cifs_fs_sb.h"
43
#include "cifs_fs_sb.h"
44
#include "fscache.h"
44
#include "fscache.h"
45
45
46
46
static inline int cifs_convert_flags(unsigned int flags)
47
static inline int cifs_convert_flags(unsigned int flags)
47
{
48
{
48
	if ((flags & O_ACCMODE) == O_RDONLY)
49
	if ((flags & O_ACCMODE) == O_RDONLY)
Lines 72-81 Link Here
72
	else if ((flags & O_ACCMODE) == O_RDWR)
73
	else if ((flags & O_ACCMODE) == O_RDWR)
73
		posix_flags = SMB_O_RDWR;
74
		posix_flags = SMB_O_RDWR;
74
75
75
	if (flags & O_CREAT)
76
	if (flags & O_CREAT) {
76
		posix_flags |= SMB_O_CREAT;
77
		posix_flags |= SMB_O_CREAT;
77
	if (flags & O_EXCL)
78
		if (flags & O_EXCL)
78
		posix_flags |= SMB_O_EXCL;
79
			posix_flags |= SMB_O_EXCL;
80
	} else if (flags & O_EXCL)
81
		cFYI(1, "Application %s pid %d has incorrectly set O_EXCL flag"
82
			"but not O_CREAT on file open. Ignoring O_EXCL",
83
			current->comm, current->tgid);
84
79
	if (flags & O_TRUNC)
85
	if (flags & O_TRUNC)
80
		posix_flags |= SMB_O_TRUNC;
86
		posix_flags |= SMB_O_TRUNC;
81
	/* be safe and imply O_SYNC for O_DSYNC */
87
	/* be safe and imply O_SYNC for O_DSYNC */
Lines 522-529 Link Here
522
		 */
528
		 */
523
		struct cifs_unix_set_info_args args = {
529
		struct cifs_unix_set_info_args args = {
524
			.mode	= inode->i_mode,
530
			.mode	= inode->i_mode,
525
			.uid	= NO_CHANGE_64,
531
			.uid	= INVALID_UID, /* no change */
526
			.gid	= NO_CHANGE_64,
532
			.gid	= INVALID_GID, /* no change */
527
			.ctime	= NO_CHANGE_64,
533
			.ctime	= NO_CHANGE_64,
528
			.atime	= NO_CHANGE_64,
534
			.atime	= NO_CHANGE_64,
529
			.mtime	= NO_CHANGE_64,
535
			.mtime	= NO_CHANGE_64,
Lines 957-963 Link Here
957
cifs_posix_lock_test(struct file *file, struct file_lock *flock)
963
cifs_posix_lock_test(struct file *file, struct file_lock *flock)
958
{
964
{
959
	int rc = 0;
965
	int rc = 0;
960
	struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
966
	struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
961
	unsigned char saved_type = flock->fl_type;
967
	unsigned char saved_type = flock->fl_type;
962
968
963
	if ((flock->fl_flags & FL_POSIX) == 0)
969
	if ((flock->fl_flags & FL_POSIX) == 0)
Lines 984-990 Link Here
984
static int
990
static int
985
cifs_posix_lock_set(struct file *file, struct file_lock *flock)
991
cifs_posix_lock_set(struct file *file, struct file_lock *flock)
986
{
992
{
987
	struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
993
	struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
988
	int rc = 1;
994
	int rc = 1;
989
995
990
	if ((flock->fl_flags & FL_POSIX) == 0)
996
	if ((flock->fl_flags & FL_POSIX) == 0)
Lines 1558-1564 Link Here
1558
1564
1559
	cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1565
	cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1560
	netfid = cfile->fid.netfid;
1566
	netfid = cfile->fid.netfid;
1561
	cinode = CIFS_I(file->f_path.dentry->d_inode);
1567
	cinode = CIFS_I(file_inode(file));
1562
1568
1563
	if (cap_unix(tcon->ses) &&
1569
	if (cap_unix(tcon->ses) &&
1564
	    (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
1570
	    (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
Lines 1703-1709 Link Here
1703
	   are always at the end of the list but since the first entry might
1709
	   are always at the end of the list but since the first entry might
1704
	   have a close pending, we go through the whole list */
1710
	   have a close pending, we go through the whole list */
1705
	list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
1711
	list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
1706
		if (fsuid_only && open_file->uid != current_fsuid())
1712
		if (fsuid_only && !uid_eq(open_file->uid, current_fsuid()))
1707
			continue;
1713
			continue;
1708
		if (OPEN_FMODE(open_file->f_flags) & FMODE_READ) {
1714
		if (OPEN_FMODE(open_file->f_flags) & FMODE_READ) {
1709
			if (!open_file->invalidHandle) {
1715
			if (!open_file->invalidHandle) {
Lines 1756-1762 Link Here
1756
	list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
1762
	list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
1757
		if (!any_available && open_file->pid != current->tgid)
1763
		if (!any_available && open_file->pid != current->tgid)
1758
			continue;
1764
			continue;
1759
		if (fsuid_only && open_file->uid != current_fsuid())
1765
		if (fsuid_only && !uid_eq(open_file->uid, current_fsuid()))
1760
			continue;
1766
			continue;
1761
		if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
1767
		if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
1762
			if (!open_file->invalidHandle) {
1768
			if (!open_file->invalidHandle) {
Lines 2181-2187 Link Here
2181
	struct cifs_tcon *tcon;
2187
	struct cifs_tcon *tcon;
2182
	struct TCP_Server_Info *server;
2188
	struct TCP_Server_Info *server;
2183
	struct cifsFileInfo *smbfile = file->private_data;
2189
	struct cifsFileInfo *smbfile = file->private_data;
2184
	struct inode *inode = file->f_path.dentry->d_inode;
2190
	struct inode *inode = file_inode(file);
2185
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2191
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2186
2192
2187
	rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
2193
	rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
Lines 2256-2262 Link Here
2256
 */
2262
 */
2257
int cifs_flush(struct file *file, fl_owner_t id)
2263
int cifs_flush(struct file *file, fl_owner_t id)
2258
{
2264
{
2259
	struct inode *inode = file->f_path.dentry->d_inode;
2265
	struct inode *inode = file_inode(file);
2260
	int rc = 0;
2266
	int rc = 0;
2261
2267
2262
	if (file->f_mode & FMODE_WRITE)
2268
	if (file->f_mode & FMODE_WRITE)
Lines 2490-2496 Link Here
2490
	ssize_t written;
2496
	ssize_t written;
2491
	struct inode *inode;
2497
	struct inode *inode;
2492
2498
2493
	inode = iocb->ki_filp->f_path.dentry->d_inode;
2499
	inode = file_inode(iocb->ki_filp);
2494
2500
2495
	/*
2501
	/*
2496
	 * BB - optimize the way when signing is disabled. We can drop this
2502
	 * BB - optimize the way when signing is disabled. We can drop this
Lines 2553-2559 Link Here
2553
cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
2559
cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
2554
		   unsigned long nr_segs, loff_t pos)
2560
		   unsigned long nr_segs, loff_t pos)
2555
{
2561
{
2556
	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
2562
	struct inode *inode = file_inode(iocb->ki_filp);
2557
	struct cifsInodeInfo *cinode = CIFS_I(inode);
2563
	struct cifsInodeInfo *cinode = CIFS_I(inode);
2558
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2564
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2559
	struct cifsFileInfo *cfile = (struct cifsFileInfo *)
2565
	struct cifsFileInfo *cfile = (struct cifsFileInfo *)
Lines 2925-2931 Link Here
2925
cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
2931
cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
2926
		  unsigned long nr_segs, loff_t pos)
2932
		  unsigned long nr_segs, loff_t pos)
2927
{
2933
{
2928
	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
2934
	struct inode *inode = file_inode(iocb->ki_filp);
2929
	struct cifsInodeInfo *cinode = CIFS_I(inode);
2935
	struct cifsInodeInfo *cinode = CIFS_I(inode);
2930
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2936
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2931
	struct cifsFileInfo *cfile = (struct cifsFileInfo *)
2937
	struct cifsFileInfo *cfile = (struct cifsFileInfo *)
Lines 3073-3079 Link Here
3073
int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
3079
int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
3074
{
3080
{
3075
	int rc, xid;
3081
	int rc, xid;
3076
	struct inode *inode = file->f_path.dentry->d_inode;
3082
	struct inode *inode = file_inode(file);
3077
3083
3078
	xid = get_xid();
3084
	xid = get_xid();
3079
3085
Lines 3366-3372 Link Here
3366
	int rc;
3372
	int rc;
3367
3373
3368
	/* Is the page cached? */
3374
	/* Is the page cached? */
3369
	rc = cifs_readpage_from_fscache(file->f_path.dentry->d_inode, page);
3375
	rc = cifs_readpage_from_fscache(file_inode(file), page);
3370
	if (rc == 0)
3376
	if (rc == 0)
3371
		goto read_complete;
3377
		goto read_complete;
3372
3378
Lines 3381-3388 Link Here
3381
	else
3387
	else
3382
		cFYI(1, "Bytes read %d", rc);
3388
		cFYI(1, "Bytes read %d", rc);
3383
3389
3384
	file->f_path.dentry->d_inode->i_atime =
3390
	file_inode(file)->i_atime =
3385
		current_fs_time(file->f_path.dentry->d_inode->i_sb);
3391
		current_fs_time(file_inode(file)->i_sb);
3386
3392
3387
	if (PAGE_CACHE_SIZE > rc)
3393
	if (PAGE_CACHE_SIZE > rc)
3388
		memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc);
3394
		memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc);
Lines 3391-3397 Link Here
3391
	SetPageUptodate(page);
3397
	SetPageUptodate(page);
3392
3398
3393
	/* send this page to the cache */
3399
	/* send this page to the cache */
3394
	cifs_readpage_to_fscache(file->f_path.dentry->d_inode, page);
3400
	cifs_readpage_to_fscache(file_inode(file), page);
3395
3401
3396
	rc = 0;
3402
	rc = 0;
3397
3403
(-)sources/3.8/inode.c (-34 / +51 lines)
Lines 169-175 Link Here
169
169
170
	if (fattr->cf_flags & CIFS_FATTR_DFS_REFERRAL)
170
	if (fattr->cf_flags & CIFS_FATTR_DFS_REFERRAL)
171
		inode->i_flags |= S_AUTOMOUNT;
171
		inode->i_flags |= S_AUTOMOUNT;
172
	cifs_set_ops(inode);
172
	if (inode->i_state & I_NEW)
173
		cifs_set_ops(inode);
173
}
174
}
174
175
175
void
176
void
Lines 244-258 Link Here
244
		break;
245
		break;
245
	}
246
	}
246
247
247
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)
248
	fattr->cf_uid = cifs_sb->mnt_uid;
248
		fattr->cf_uid = cifs_sb->mnt_uid;
249
	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)) {
249
	else
250
		u64 id = le64_to_cpu(info->Uid);
250
		fattr->cf_uid = le64_to_cpu(info->Uid);
251
		if (id < ((uid_t)-1)) {
251
252
			kuid_t uid = make_kuid(&init_user_ns, id);
252
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)
253
			if (uid_valid(uid))
253
		fattr->cf_gid = cifs_sb->mnt_gid;
254
				fattr->cf_uid = uid;
254
	else
255
		}
255
		fattr->cf_gid = le64_to_cpu(info->Gid);
256
	}
257
	
258
	fattr->cf_gid = cifs_sb->mnt_gid;
259
	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)) {
260
		u64 id = le64_to_cpu(info->Gid);
261
		if (id < ((gid_t)-1)) {
262
			kgid_t gid = make_kgid(&init_user_ns, id);
263
			if (gid_valid(gid))
264
				fattr->cf_gid = gid;
265
		}
266
	}
256
267
257
	fattr->cf_nlink = le64_to_cpu(info->Nlinks);
268
	fattr->cf_nlink = le64_to_cpu(info->Nlinks);
258
}
269
}
Lines 289-295 Link Here
289
	unsigned int xid;
300
	unsigned int xid;
290
	FILE_UNIX_BASIC_INFO find_data;
301
	FILE_UNIX_BASIC_INFO find_data;
291
	struct cifs_fattr fattr;
302
	struct cifs_fattr fattr;
292
	struct inode *inode = filp->f_path.dentry->d_inode;
303
	struct inode *inode = file_inode(filp);
293
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
304
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
294
	struct cifsFileInfo *cfile = filp->private_data;
305
	struct cifsFileInfo *cfile = filp->private_data;
295
	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
306
	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
Lines 558-564 Link Here
558
	unsigned int xid;
569
	unsigned int xid;
559
	FILE_ALL_INFO find_data;
570
	FILE_ALL_INFO find_data;
560
	struct cifs_fattr fattr;
571
	struct cifs_fattr fattr;
561
	struct inode *inode = filp->f_path.dentry->d_inode;
572
	struct inode *inode = file_inode(filp);
562
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
573
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
563
	struct cifsFileInfo *cfile = filp->private_data;
574
	struct cifsFileInfo *cfile = filp->private_data;
564
	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
575
	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
Lines 806-815 Link Here
806
inode_has_hashed_dentries(struct inode *inode)
817
inode_has_hashed_dentries(struct inode *inode)
807
{
818
{
808
	struct dentry *dentry;
819
	struct dentry *dentry;
809
	struct hlist_node *p;
810
820
811
	spin_lock(&inode->i_lock);
821
	spin_lock(&inode->i_lock);
812
	hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) {
822
	hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
813
		if (!d_unhashed(dentry) || IS_ROOT(dentry)) {
823
		if (!d_unhashed(dentry) || IS_ROOT(dentry)) {
814
			spin_unlock(&inode->i_lock);
824
			spin_unlock(&inode->i_lock);
815
			return true;
825
			return true;
Lines 986-991 Link Here
986
		return PTR_ERR(tlink);
996
		return PTR_ERR(tlink);
987
	tcon = tlink_tcon(tlink);
997
	tcon = tlink_tcon(tlink);
988
998
999
	/*
1000
	 * We cannot rename the file if the server doesn't support
1001
	 * CAP_INFOLEVEL_PASSTHRU
1002
	 */
1003
	if (!(tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU)) {
1004
		rc = -EBUSY;
1005
		goto out;
1006
	}
1007
989
	rc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN,
1008
	rc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN,
990
			 DELETE|FILE_WRITE_ATTRIBUTES, FILE_SHARE_ALL, CREATE_NOT_DIR,
1009
			 DELETE|FILE_WRITE_ATTRIBUTES, FILE_SHARE_ALL, CREATE_NOT_DIR,
991
			 &netfid, &oplock, NULL, cifs_sb->local_nls,
1010
			 &netfid, &oplock, NULL, cifs_sb->local_nls,
Lines 1014-1020 Link Here
1014
					current->tgid);
1033
					current->tgid);
1015
		/* although we would like to mark the file hidden
1034
		/* although we would like to mark the file hidden
1016
 		   if that fails we will still try to rename it */
1035
 		   if that fails we will still try to rename it */
1017
		if (rc != 0)
1036
		if (!rc)
1018
			cifsInode->cifsAttrs = dosattr;
1037
			cifsInode->cifsAttrs = dosattr;
1019
		else
1038
		else
1020
			dosattr = origattr; /* since not able to change them */
1039
			dosattr = origattr; /* since not able to change them */
Lines 1025-1031 Link Here
1025
				   cifs_sb->mnt_cifs_flags &
1044
				   cifs_sb->mnt_cifs_flags &
1026
					    CIFS_MOUNT_MAP_SPECIAL_CHR);
1045
					    CIFS_MOUNT_MAP_SPECIAL_CHR);
1027
	if (rc != 0) {
1046
	if (rc != 0) {
1028
		rc = -ETXTBSY;
1047
		rc = -EBUSY;
1029
		goto undo_setattr;
1048
		goto undo_setattr;
1030
	}
1049
	}
1031
1050
Lines 1044-1050 Link Here
1044
		if (rc == -ENOENT)
1063
		if (rc == -ENOENT)
1045
			rc = 0;
1064
			rc = 0;
1046
		else if (rc != 0) {
1065
		else if (rc != 0) {
1047
			rc = -ETXTBSY;
1066
			rc = -EBUSY;
1048
			goto undo_rename;
1067
			goto undo_rename;
1049
		}
1068
		}
1050
		cifsInode->delete_pending = true;
1069
		cifsInode->delete_pending = true;
Lines 1151-1165 Link Here
1151
			cifs_drop_nlink(inode);
1170
			cifs_drop_nlink(inode);
1152
	} else if (rc == -ENOENT) {
1171
	} else if (rc == -ENOENT) {
1153
		d_drop(dentry);
1172
		d_drop(dentry);
1154
	} else if (rc == -ETXTBSY) {
1173
	} else if (rc == -EBUSY) {
1155
		if (server->ops->rename_pending_delete) {
1174
		if (server->ops->rename_pending_delete) {
1156
			rc = server->ops->rename_pending_delete(full_path,
1175
			rc = server->ops->rename_pending_delete(full_path,
1157
								dentry, xid);
1176
								dentry, xid);
1158
			if (rc == 0)
1177
			if (rc == 0)
1159
				cifs_drop_nlink(inode);
1178
				cifs_drop_nlink(inode);
1160
		}
1179
		}
1161
		if (rc == -ETXTBSY)
1162
			rc = -EBUSY;
1163
	} else if ((rc == -EACCES) && (dosattr == 0) && inode) {
1180
	} else if ((rc == -EACCES) && (dosattr == 0) && inode) {
1164
		attrs = kzalloc(sizeof(*attrs), GFP_KERNEL);
1181
		attrs = kzalloc(sizeof(*attrs), GFP_KERNEL);
1165
		if (attrs == NULL) {
1182
		if (attrs == NULL) {
Lines 1245-1258 Link Here
1245
			.device	= 0,
1262
			.device	= 0,
1246
		};
1263
		};
1247
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
1264
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
1248
			args.uid = (__u64)current_fsuid();
1265
			args.uid = current_fsuid();
1249
			if (parent->i_mode & S_ISGID)
1266
			if (parent->i_mode & S_ISGID)
1250
				args.gid = (__u64)parent->i_gid;
1267
				args.gid = parent->i_gid;
1251
			else
1268
			else
1252
				args.gid = (__u64)current_fsgid();
1269
				args.gid = current_fsgid();
1253
		} else {
1270
		} else {
1254
			args.uid = NO_CHANGE_64;
1271
			args.uid = INVALID_UID; /* no change */
1255
			args.gid = NO_CHANGE_64;
1272
			args.gid = INVALID_GID; /* no change */
1256
		}
1273
		}
1257
		CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args,
1274
		CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args,
1258
				       cifs_sb->local_nls,
1275
				       cifs_sb->local_nls,
Lines 1500-1506 Link Here
1500
	 * source. Note that cross directory moves do not work with
1517
	 * source. Note that cross directory moves do not work with
1501
	 * rename by filehandle to various Windows servers.
1518
	 * rename by filehandle to various Windows servers.
1502
	 */
1519
	 */
1503
	if (rc == 0 || rc != -ETXTBSY)
1520
	if (rc == 0 || rc != -EBUSY)
1504
		goto do_rename_exit;
1521
		goto do_rename_exit;
1505
1522
1506
	/* open-file renames don't work across directories */
1523
	/* open-file renames don't work across directories */
Lines 1678-1684 Link Here
1678
int cifs_revalidate_file_attr(struct file *filp)
1695
int cifs_revalidate_file_attr(struct file *filp)
1679
{
1696
{
1680
	int rc = 0;
1697
	int rc = 0;
1681
	struct inode *inode = filp->f_path.dentry->d_inode;
1698
	struct inode *inode = file_inode(filp);
1682
	struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data;
1699
	struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data;
1683
1700
1684
	if (!cifs_inode_needs_reval(inode))
1701
	if (!cifs_inode_needs_reval(inode))
Lines 1735-1741 Link Here
1735
int cifs_revalidate_file(struct file *filp)
1752
int cifs_revalidate_file(struct file *filp)
1736
{
1753
{
1737
	int rc;
1754
	int rc;
1738
	struct inode *inode = filp->f_path.dentry->d_inode;
1755
	struct inode *inode = file_inode(filp);
1739
1756
1740
	rc = cifs_revalidate_file_attr(filp);
1757
	rc = cifs_revalidate_file_attr(filp);
1741
	if (rc)
1758
	if (rc)
Lines 2013-2024 Link Here
2013
	if (attrs->ia_valid & ATTR_UID)
2030
	if (attrs->ia_valid & ATTR_UID)
2014
		args->uid = attrs->ia_uid;
2031
		args->uid = attrs->ia_uid;
2015
	else
2032
	else
2016
		args->uid = NO_CHANGE_64;
2033
		args->uid = INVALID_UID; /* no change */
2017
2034
2018
	if (attrs->ia_valid & ATTR_GID)
2035
	if (attrs->ia_valid & ATTR_GID)
2019
		args->gid = attrs->ia_gid;
2036
		args->gid = attrs->ia_gid;
2020
	else
2037
	else
2021
		args->gid = NO_CHANGE_64;
2038
		args->gid = INVALID_GID; /* no change */
2022
2039
2023
	if (attrs->ia_valid & ATTR_ATIME)
2040
	if (attrs->ia_valid & ATTR_ATIME)
2024
		args->atime = cifs_UnixTimeToNT(attrs->ia_atime);
2041
		args->atime = cifs_UnixTimeToNT(attrs->ia_atime);
Lines 2086-2093 Link Here
2086
cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2103
cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2087
{
2104
{
2088
	unsigned int xid;
2105
	unsigned int xid;
2089
	uid_t uid = NO_CHANGE_32;
2106
	kuid_t uid = INVALID_UID;
2090
	gid_t gid = NO_CHANGE_32;
2107
	kgid_t gid = INVALID_GID;
2091
	struct inode *inode = direntry->d_inode;
2108
	struct inode *inode = direntry->d_inode;
2092
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2109
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2093
	struct cifsInodeInfo *cifsInode = CIFS_I(inode);
2110
	struct cifsInodeInfo *cifsInode = CIFS_I(inode);
Lines 2146-2152 Link Here
2146
2163
2147
#ifdef CONFIG_CIFS_ACL
2164
#ifdef CONFIG_CIFS_ACL
2148
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
2165
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
2149
		if (uid != NO_CHANGE_32 || gid != NO_CHANGE_32) {
2166
		if (uid_valid(uid) || gid_valid(gid)) {
2150
			rc = id_mode_to_cifs_acl(inode, full_path, NO_CHANGE_64,
2167
			rc = id_mode_to_cifs_acl(inode, full_path, NO_CHANGE_64,
2151
							uid, gid);
2168
							uid, gid);
2152
			if (rc) {
2169
			if (rc) {
Lines 2170-2176 Link Here
2170
#ifdef CONFIG_CIFS_ACL
2187
#ifdef CONFIG_CIFS_ACL
2171
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
2188
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
2172
			rc = id_mode_to_cifs_acl(inode, full_path, mode,
2189
			rc = id_mode_to_cifs_acl(inode, full_path, mode,
2173
						NO_CHANGE_32, NO_CHANGE_32);
2190
						INVALID_UID, INVALID_GID);
2174
			if (rc) {
2191
			if (rc) {
2175
				cFYI(1, "%s: Setting ACL failed with error: %d",
2192
				cFYI(1, "%s: Setting ACL failed with error: %d",
2176
					__func__, rc);
2193
					__func__, rc);
(-)sources/3.8/ioctl.c (-1 / +1 lines)
Lines 30-36 Link Here
30
30
31
long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
31
long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
32
{
32
{
33
	struct inode *inode = filep->f_dentry->d_inode;
33
	struct inode *inode = file_inode(filep);
34
	int rc = -ENOTTY; /* strange error - but the precedent */
34
	int rc = -ENOTTY; /* strange error - but the precedent */
35
	unsigned int xid;
35
	unsigned int xid;
36
	struct cifs_sb_info *cifs_sb;
36
	struct cifs_sb_info *cifs_sb;
(-)sources/3.8/Kconfig (-4 / +4 lines)
Lines 155-168 Link Here
155
	    points. If unsure, say N.
155
	    points. If unsure, say N.
156
156
157
config CIFS_NFSD_EXPORT
157
config CIFS_NFSD_EXPORT
158
	  bool "Allow nfsd to export CIFS file system (EXPERIMENTAL)"
158
	  bool "Allow nfsd to export CIFS file system"
159
	  depends on CIFS && EXPERIMENTAL && BROKEN
159
	  depends on CIFS && BROKEN
160
	  help
160
	  help
161
	   Allows NFS server to export a CIFS mounted share (nfsd over cifs)
161
	   Allows NFS server to export a CIFS mounted share (nfsd over cifs)
162
162
163
config CIFS_SMB2
163
config CIFS_SMB2
164
	bool "SMB2 network file system support (EXPERIMENTAL)"
164
	bool "SMB2 network file system support"
165
	depends on CIFS && EXPERIMENTAL && INET
165
	depends on CIFS && INET
166
	select NLS
166
	select NLS
167
	select KEYS
167
	select KEYS
168
	select FSCACHE
168
	select FSCACHE
(-)sources/3.8/link.c (-1 / +1 lines)
Lines 76-82 Link Here
76
	}
76
	}
77
	rc = crypto_shash_update(&sdescmd5->shash, link_str, link_len);
77
	rc = crypto_shash_update(&sdescmd5->shash, link_str, link_len);
78
	if (rc) {
78
	if (rc) {
79
		cERROR(1, "%s: Could not update iwth link_str", __func__);
79
		cERROR(1, "%s: Could not update with link_str", __func__);
80
		goto symlink_hash_err;
80
		goto symlink_hash_err;
81
	}
81
	}
82
	rc = crypto_shash_final(&sdescmd5->shash, md5_hash);
82
	rc = crypto_shash_final(&sdescmd5->shash, md5_hash);
(-)sources/3.8/misc.c (-1 / +1 lines)
Lines 569-575 Link Here
569
backup_cred(struct cifs_sb_info *cifs_sb)
569
backup_cred(struct cifs_sb_info *cifs_sb)
570
{
570
{
571
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) {
571
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) {
572
		if (cifs_sb->mnt_backupuid == current_fsuid())
572
		if (uid_eq(cifs_sb->mnt_backupuid, current_fsuid()))
573
			return true;
573
			return true;
574
	}
574
	}
575
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) {
575
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) {
(-)sources/3.8/netmisc.c (-1 / +1 lines)
Lines 62-68 Link Here
62
	{ERRdiffdevice, -EXDEV},
62
	{ERRdiffdevice, -EXDEV},
63
	{ERRnofiles, -ENOENT},
63
	{ERRnofiles, -ENOENT},
64
	{ERRwriteprot, -EROFS},
64
	{ERRwriteprot, -EROFS},
65
	{ERRbadshare, -ETXTBSY},
65
	{ERRbadshare, -EBUSY},
66
	{ERRlock, -EACCES},
66
	{ERRlock, -EACCES},
67
	{ERRunsup, -EINVAL},
67
	{ERRunsup, -EINVAL},
68
	{ERRnosuchshare, -ENXIO},
68
	{ERRnosuchshare, -ENXIO},
(-)sources/3.8/readdir.c (-7 / +5 lines)
Lines 82-93 Link Here
82
82
83
	cFYI(1, "%s: for %s", __func__, name->name);
83
	cFYI(1, "%s: for %s", __func__, name->name);
84
84
85
	if (parent->d_op && parent->d_op->d_hash)
85
	dentry = d_hash_and_lookup(parent, name);
86
		parent->d_op->d_hash(parent, parent->d_inode, name);
86
	if (unlikely(IS_ERR(dentry)))
87
	else
87
		return;
88
		name->hash = full_name_hash(name->name, name->len);
89
88
90
	dentry = d_lookup(parent, name);
91
	if (dentry) {
89
	if (dentry) {
92
		int err;
90
		int err;
93
91
Lines 505-511 Link Here
505
   whether we can use the cached search results from the previous search */
503
   whether we can use the cached search results from the previous search */
506
static int is_dir_changed(struct file *file)
504
static int is_dir_changed(struct file *file)
507
{
505
{
508
	struct inode *inode = file->f_path.dentry->d_inode;
506
	struct inode *inode = file_inode(file);
509
	struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
507
	struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
510
508
511
	if (cifsInfo->time == 0)
509
	if (cifsInfo->time == 0)
Lines 778-784 Link Here
778
	switch ((int) file->f_pos) {
776
	switch ((int) file->f_pos) {
779
	case 0:
777
	case 0:
780
		if (filldir(direntry, ".", 1, file->f_pos,
778
		if (filldir(direntry, ".", 1, file->f_pos,
781
		     file->f_path.dentry->d_inode->i_ino, DT_DIR) < 0) {
779
		     file_inode(file)->i_ino, DT_DIR) < 0) {
782
			cERROR(1, "Filldir for current dir failed");
780
			cERROR(1, "Filldir for current dir failed");
783
			rc = -ENOMEM;
781
			rc = -ENOMEM;
784
			break;
782
			break;

Return to bug 9444