diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-04 21:37:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-04 21:37:09 -0400 |
commit | 43f63c8711ce02226b7bbdafeba7b8031faf3fb4 (patch) | |
tree | b279ac78cc010464a8c757f352303511a87b855d | |
parent | 6c216ec636f75d834461be15f83ec41a6759bd2b (diff) | |
parent | e4b41fb9dafb9af4fecb602bf73d858ab651eeed (diff) |
Merge git://git.samba.org/sfrench/cifs-2.6
Pull CIFS fixes from Steve French.
* git://git.samba.org/sfrench/cifs-2.6:
Fix UNC parsing on mount
Remove unnecessary check for NULL in password parser
CIFS: Fix VFS lock usage for oplocked files
Revert "CIFS: Fix VFS lock usage for oplocked files"
cifs: writing past end of struct in cifs_convert_address()
cifs: silence compiler warnings showing up with gcc-4.7.0
CIFS: Fix VFS lock usage for oplocked files
-rw-r--r-- | fs/cifs/cifssmb.c | 24 | ||||
-rw-r--r-- | fs/cifs/connect.c | 17 | ||||
-rw-r--r-- | fs/cifs/file.c | 10 | ||||
-rw-r--r-- | fs/cifs/netmisc.c | 3 | ||||
-rw-r--r-- | fs/locks.c | 3 | ||||
-rw-r--r-- | include/linux/fs.h | 5 |
6 files changed, 37 insertions, 25 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 8fecc99be344..f52c5ab78f9d 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -3892,13 +3892,12 @@ CIFSSMBSetCIFSACL(const int xid, struct cifs_tcon *tcon, __u16 fid, | |||
3892 | int rc = 0; | 3892 | int rc = 0; |
3893 | int bytes_returned = 0; | 3893 | int bytes_returned = 0; |
3894 | SET_SEC_DESC_REQ *pSMB = NULL; | 3894 | SET_SEC_DESC_REQ *pSMB = NULL; |
3895 | NTRANSACT_RSP *pSMBr = NULL; | 3895 | void *pSMBr; |
3896 | 3896 | ||
3897 | setCifsAclRetry: | 3897 | setCifsAclRetry: |
3898 | rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, | 3898 | rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, &pSMBr); |
3899 | (void **) &pSMBr); | ||
3900 | if (rc) | 3899 | if (rc) |
3901 | return (rc); | 3900 | return rc; |
3902 | 3901 | ||
3903 | pSMB->MaxSetupCount = 0; | 3902 | pSMB->MaxSetupCount = 0; |
3904 | pSMB->Reserved = 0; | 3903 | pSMB->Reserved = 0; |
@@ -3926,9 +3925,8 @@ setCifsAclRetry: | |||
3926 | pSMB->AclFlags = cpu_to_le32(aclflag); | 3925 | pSMB->AclFlags = cpu_to_le32(aclflag); |
3927 | 3926 | ||
3928 | if (pntsd && acllen) { | 3927 | if (pntsd && acllen) { |
3929 | memcpy((char *) &pSMBr->hdr.Protocol + data_offset, | 3928 | memcpy((char *)pSMBr + offsetof(struct smb_hdr, Protocol) + |
3930 | (char *) pntsd, | 3929 | data_offset, pntsd, acllen); |
3931 | acllen); | ||
3932 | inc_rfc1001_len(pSMB, byte_count + data_count); | 3930 | inc_rfc1001_len(pSMB, byte_count + data_count); |
3933 | } else | 3931 | } else |
3934 | inc_rfc1001_len(pSMB, byte_count); | 3932 | inc_rfc1001_len(pSMB, byte_count); |
@@ -5708,7 +5706,8 @@ CIFSSMBSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5708 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | 5706 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; |
5709 | offset = param_offset + params; | 5707 | offset = param_offset + params; |
5710 | 5708 | ||
5711 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | 5709 | data_offset = (char *)pSMB + |
5710 | offsetof(struct smb_hdr, Protocol) + offset; | ||
5712 | 5711 | ||
5713 | count = sizeof(FILE_BASIC_INFO); | 5712 | count = sizeof(FILE_BASIC_INFO); |
5714 | pSMB->MaxParameterCount = cpu_to_le16(2); | 5713 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -5977,7 +5976,7 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5977 | u16 fid, u32 pid_of_opener) | 5976 | u16 fid, u32 pid_of_opener) |
5978 | { | 5977 | { |
5979 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 5978 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
5980 | FILE_UNIX_BASIC_INFO *data_offset; | 5979 | char *data_offset; |
5981 | int rc = 0; | 5980 | int rc = 0; |
5982 | u16 params, param_offset, offset, byte_count, count; | 5981 | u16 params, param_offset, offset, byte_count, count; |
5983 | 5982 | ||
@@ -5999,8 +5998,9 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5999 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | 5998 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; |
6000 | offset = param_offset + params; | 5999 | offset = param_offset + params; |
6001 | 6000 | ||
6002 | data_offset = (FILE_UNIX_BASIC_INFO *) | 6001 | data_offset = (char *)pSMB + |
6003 | ((char *)(&pSMB->hdr.Protocol) + offset); | 6002 | offsetof(struct smb_hdr, Protocol) + offset; |
6003 | |||
6004 | count = sizeof(FILE_UNIX_BASIC_INFO); | 6004 | count = sizeof(FILE_UNIX_BASIC_INFO); |
6005 | 6005 | ||
6006 | pSMB->MaxParameterCount = cpu_to_le16(2); | 6006 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -6022,7 +6022,7 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
6022 | inc_rfc1001_len(pSMB, byte_count); | 6022 | inc_rfc1001_len(pSMB, byte_count); |
6023 | pSMB->ByteCount = cpu_to_le16(byte_count); | 6023 | pSMB->ByteCount = cpu_to_le16(byte_count); |
6024 | 6024 | ||
6025 | cifs_fill_unix_set_info(data_offset, args); | 6025 | cifs_fill_unix_set_info((FILE_UNIX_BASIC_INFO *)data_offset, args); |
6026 | 6026 | ||
6027 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); | 6027 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); |
6028 | if (rc) | 6028 | if (rc) |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 302a15c505a9..d81e933a796b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1565,8 +1565,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1565 | 1565 | ||
1566 | /* Obtain the value string */ | 1566 | /* Obtain the value string */ |
1567 | value = strchr(data, '='); | 1567 | value = strchr(data, '='); |
1568 | if (value != NULL) | 1568 | value++; |
1569 | *value++ = '\0'; | ||
1570 | 1569 | ||
1571 | /* Set tmp_end to end of the string */ | 1570 | /* Set tmp_end to end of the string */ |
1572 | tmp_end = (char *) value + strlen(value); | 1571 | tmp_end = (char *) value + strlen(value); |
@@ -1649,6 +1648,13 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1649 | goto cifs_parse_mount_err; | 1648 | goto cifs_parse_mount_err; |
1650 | } | 1649 | } |
1651 | 1650 | ||
1651 | vol->UNC = kmalloc(temp_len+1, GFP_KERNEL); | ||
1652 | if (vol->UNC == NULL) { | ||
1653 | printk(KERN_WARNING "CIFS: no memory for UNC\n"); | ||
1654 | goto cifs_parse_mount_err; | ||
1655 | } | ||
1656 | strcpy(vol->UNC, string); | ||
1657 | |||
1652 | if (strncmp(string, "//", 2) == 0) { | 1658 | if (strncmp(string, "//", 2) == 0) { |
1653 | vol->UNC[0] = '\\'; | 1659 | vol->UNC[0] = '\\'; |
1654 | vol->UNC[1] = '\\'; | 1660 | vol->UNC[1] = '\\'; |
@@ -1658,13 +1664,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1658 | goto cifs_parse_mount_err; | 1664 | goto cifs_parse_mount_err; |
1659 | } | 1665 | } |
1660 | 1666 | ||
1661 | vol->UNC = kmalloc(temp_len+1, GFP_KERNEL); | ||
1662 | if (vol->UNC == NULL) { | ||
1663 | printk(KERN_WARNING "CIFS: no memory " | ||
1664 | "for UNC\n"); | ||
1665 | goto cifs_parse_mount_err; | ||
1666 | } | ||
1667 | strcpy(vol->UNC, string); | ||
1668 | break; | 1667 | break; |
1669 | case Opt_domain: | 1668 | case Opt_domain: |
1670 | string = match_strdup(args); | 1669 | string = match_strdup(args); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 460d87b7cda0..fae765dac934 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -835,13 +835,21 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock) | |||
835 | if ((flock->fl_flags & FL_POSIX) == 0) | 835 | if ((flock->fl_flags & FL_POSIX) == 0) |
836 | return rc; | 836 | return rc; |
837 | 837 | ||
838 | try_again: | ||
838 | mutex_lock(&cinode->lock_mutex); | 839 | mutex_lock(&cinode->lock_mutex); |
839 | if (!cinode->can_cache_brlcks) { | 840 | if (!cinode->can_cache_brlcks) { |
840 | mutex_unlock(&cinode->lock_mutex); | 841 | mutex_unlock(&cinode->lock_mutex); |
841 | return rc; | 842 | return rc; |
842 | } | 843 | } |
843 | rc = posix_lock_file_wait(file, flock); | 844 | |
845 | rc = posix_lock_file(file, flock, NULL); | ||
844 | mutex_unlock(&cinode->lock_mutex); | 846 | mutex_unlock(&cinode->lock_mutex); |
847 | if (rc == FILE_LOCK_DEFERRED) { | ||
848 | rc = wait_event_interruptible(flock->fl_wait, !flock->fl_next); | ||
849 | if (!rc) | ||
850 | goto try_again; | ||
851 | locks_delete_block(flock); | ||
852 | } | ||
845 | return rc; | 853 | return rc; |
846 | } | 854 | } |
847 | 855 | ||
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index dd23a321bdda..581c225f7f50 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -197,8 +197,7 @@ cifs_convert_address(struct sockaddr *dst, const char *src, int len) | |||
197 | memcpy(scope_id, pct + 1, slen); | 197 | memcpy(scope_id, pct + 1, slen); |
198 | scope_id[slen] = '\0'; | 198 | scope_id[slen] = '\0'; |
199 | 199 | ||
200 | rc = strict_strtoul(scope_id, 0, | 200 | rc = kstrtouint(scope_id, 0, &s6->sin6_scope_id); |
201 | (unsigned long *)&s6->sin6_scope_id); | ||
202 | rc = (rc == 0) ? 1 : 0; | 201 | rc = (rc == 0) ? 1 : 0; |
203 | } | 202 | } |
204 | 203 | ||
diff --git a/fs/locks.c b/fs/locks.c index 637694bf3a03..0d68f1f81799 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -510,12 +510,13 @@ static void __locks_delete_block(struct file_lock *waiter) | |||
510 | 510 | ||
511 | /* | 511 | /* |
512 | */ | 512 | */ |
513 | static void locks_delete_block(struct file_lock *waiter) | 513 | void locks_delete_block(struct file_lock *waiter) |
514 | { | 514 | { |
515 | lock_flocks(); | 515 | lock_flocks(); |
516 | __locks_delete_block(waiter); | 516 | __locks_delete_block(waiter); |
517 | unlock_flocks(); | 517 | unlock_flocks(); |
518 | } | 518 | } |
519 | EXPORT_SYMBOL(locks_delete_block); | ||
519 | 520 | ||
520 | /* Insert waiter into blocker's block list. | 521 | /* Insert waiter into blocker's block list. |
521 | * We use a circular list so that processes can be easily woken up in | 522 | * We use a circular list so that processes can be easily woken up in |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 135693e79f2b..528611843ba0 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1215,6 +1215,7 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
1215 | extern int lease_modify(struct file_lock **, int); | 1215 | extern int lease_modify(struct file_lock **, int); |
1216 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1216 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1217 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1217 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1218 | extern void locks_delete_block(struct file_lock *waiter); | ||
1218 | extern void lock_flocks(void); | 1219 | extern void lock_flocks(void); |
1219 | extern void unlock_flocks(void); | 1220 | extern void unlock_flocks(void); |
1220 | #else /* !CONFIG_FILE_LOCKING */ | 1221 | #else /* !CONFIG_FILE_LOCKING */ |
@@ -1359,6 +1360,10 @@ static inline int lock_may_write(struct inode *inode, loff_t start, | |||
1359 | return 1; | 1360 | return 1; |
1360 | } | 1361 | } |
1361 | 1362 | ||
1363 | static inline void locks_delete_block(struct file_lock *waiter) | ||
1364 | { | ||
1365 | } | ||
1366 | |||
1362 | static inline void lock_flocks(void) | 1367 | static inline void lock_flocks(void) |
1363 | { | 1368 | { |
1364 | } | 1369 | } |