Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etercifs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etercifs
Commits
b35deed4
Commit
b35deed4
authored
Nov 09, 2013
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 3.10 sources from stable (v3.10.18)
parent
b0966a09
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
116 additions
and
87 deletions
+116
-87
cifs_unicode.h
sources/3.10/cifs_unicode.h
+4
-4
cifsencrypt.c
sources/3.10/cifsencrypt.c
+4
-4
cifsglob.h
sources/3.10/cifsglob.h
+1
-0
connect.c
sources/3.10/connect.c
+6
-3
dir.c
sources/3.10/dir.c
+1
-0
file.c
sources/3.10/file.c
+4
-5
inode.c
sources/3.10/inode.c
+5
-0
readdir.c
sources/3.10/readdir.c
+8
-0
sess.c
sources/3.10/sess.c
+3
-3
smb2misc.c
sources/3.10/smb2misc.c
+80
-68
No files found.
sources/3.10/cifs_unicode.h
View file @
b35deed4
...
...
@@ -327,14 +327,14 @@ UniToupper(register wchar_t uc)
/*
* UniStrupr: Upper case a unicode string
*/
static
inline
wchar_t
*
UniStrupr
(
register
wchar_t
*
upin
)
static
inline
__le16
*
UniStrupr
(
register
__le16
*
upin
)
{
register
wchar_t
*
up
;
register
__le16
*
up
;
up
=
upin
;
while
(
*
up
)
{
/* For all characters */
*
up
=
UniToupper
(
*
up
);
*
up
=
cpu_to_le16
(
UniToupper
(
le16_to_cpu
(
*
up
))
);
up
++
;
}
return
upin
;
/* Return input pointer */
...
...
sources/3.10/cifsencrypt.c
View file @
b35deed4
...
...
@@ -389,7 +389,7 @@ find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp)
if
(
blobptr
+
attrsize
>
blobend
)
break
;
if
(
type
==
NTLMSSP_AV_NB_DOMAIN_NAME
)
{
if
(
!
attrsize
)
if
(
!
attrsize
||
attrsize
>=
CIFS_MAX_DOMAINNAME_LEN
)
break
;
if
(
!
ses
->
domainName
)
{
ses
->
domainName
=
...
...
@@ -414,7 +414,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
int
rc
=
0
;
int
len
;
char
nt_hash
[
CIFS_NTHASH_SIZE
];
wchar_t
*
user
;
__le16
*
user
;
wchar_t
*
domain
;
wchar_t
*
server
;
...
...
@@ -439,7 +439,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
return
rc
;
}
/* convert ses->user_name to unicode
and uppercase
*/
/* convert ses->user_name to unicode */
len
=
ses
->
user_name
?
strlen
(
ses
->
user_name
)
:
0
;
user
=
kmalloc
(
2
+
(
len
*
2
),
GFP_KERNEL
);
if
(
user
==
NULL
)
{
...
...
@@ -448,7 +448,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
}
if
(
len
)
{
len
=
cifs_strtoUTF16
(
(
__le16
*
)
user
,
ses
->
user_name
,
len
,
nls_cp
);
len
=
cifs_strtoUTF16
(
user
,
ses
->
user_name
,
len
,
nls_cp
);
UniStrupr
(
user
);
}
else
{
memset
(
user
,
'\0'
,
2
);
...
...
sources/3.10/cifsglob.h
View file @
b35deed4
...
...
@@ -44,6 +44,7 @@
#define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)
#define MAX_SERVER_SIZE 15
#define MAX_SHARE_SIZE 80
#define CIFS_MAX_DOMAINNAME_LEN 256
/* max domain name length */
#define MAX_USERNAME_SIZE 256
/* reasonable maximum for current servers */
#define MAX_PASSWORD_SIZE 512
/* max for windows seems to be 256 wide chars */
...
...
sources/3.10/connect.c
View file @
b35deed4
...
...
@@ -378,6 +378,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
try_to_freeze
();
/* we should try only the port we connected to before */
mutex_lock
(
&
server
->
srv_mutex
);
rc
=
generic_ip_connect
(
server
);
if
(
rc
)
{
cifs_dbg
(
FYI
,
"reconnect error %d
\n
"
,
rc
);
...
...
@@ -389,6 +390,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
server
->
tcpStatus
=
CifsNeedNegotiate
;
spin_unlock
(
&
GlobalMid_Lock
);
}
mutex_unlock
(
&
server
->
srv_mutex
);
}
while
(
server
->
tcpStatus
==
CifsNeedReconnect
);
return
rc
;
...
...
@@ -1667,7 +1669,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
if
(
string
==
NULL
)
goto
out_nomem
;
if
(
strnlen
(
string
,
256
)
==
256
)
{
if
(
strnlen
(
string
,
CIFS_MAX_DOMAINNAME_LEN
)
==
CIFS_MAX_DOMAINNAME_LEN
)
{
printk
(
KERN_WARNING
"CIFS: domain name too"
" long
\n
"
);
goto
cifs_parse_mount_err
;
...
...
@@ -2293,8 +2296,8 @@ cifs_put_smb_ses(struct cifs_ses *ses)
#ifdef CONFIG_KEYS
/* strlen("cifs:a:") +
INET6_ADDRSTR
LEN + 1 */
#define CIFSCREDS_DESC_SIZE (7 +
INET6_ADDRSTR
LEN + 1)
/* strlen("cifs:a:") +
CIFS_MAX_DOMAINNAME_
LEN + 1 */
#define CIFSCREDS_DESC_SIZE (7 +
CIFS_MAX_DOMAINNAME_
LEN + 1)
/* Populate username and pw fields from keyring if possible */
static
int
...
...
sources/3.10/dir.c
View file @
b35deed4
...
...
@@ -495,6 +495,7 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
if
(
server
->
ops
->
close
)
server
->
ops
->
close
(
xid
,
tcon
,
&
fid
);
cifs_del_pending_open
(
&
open
);
fput
(
file
);
rc
=
-
ENOMEM
;
}
...
...
sources/3.10/file.c
View file @
b35deed4
...
...
@@ -556,11 +556,10 @@ cifs_relock_file(struct cifsFileInfo *cfile)
struct
cifs_tcon
*
tcon
=
tlink_tcon
(
cfile
->
tlink
);
int
rc
=
0
;
/* we are going to update can_cache_brlcks here - need a write access */
down_write
(
&
cinode
->
lock_sem
);
down_read
(
&
cinode
->
lock_sem
);
if
(
cinode
->
can_cache_brlcks
)
{
/* can cache locks - no need to
push them
*/
up_
write
(
&
cinode
->
lock_sem
);
/* can cache locks - no need to
relock
*/
up_
read
(
&
cinode
->
lock_sem
);
return
rc
;
}
...
...
@@ -571,7 +570,7 @@ cifs_relock_file(struct cifsFileInfo *cfile)
else
rc
=
tcon
->
ses
->
server
->
ops
->
push_mand_locks
(
cfile
);
up_
write
(
&
cinode
->
lock_sem
);
up_
read
(
&
cinode
->
lock_sem
);
return
rc
;
}
...
...
sources/3.10/inode.c
View file @
b35deed4
...
...
@@ -558,6 +558,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
fattr
->
cf_mode
&=
~
(
S_IWUGO
);
fattr
->
cf_nlink
=
le32_to_cpu
(
info
->
NumberOfLinks
);
if
(
fattr
->
cf_nlink
<
1
)
{
cifs_dbg
(
1
,
"replacing bogus file nlink value %u
\n
"
,
fattr
->
cf_nlink
);
fattr
->
cf_nlink
=
1
;
}
}
fattr
->
cf_uid
=
cifs_sb
->
mnt_uid
;
...
...
sources/3.10/readdir.c
View file @
b35deed4
...
...
@@ -111,6 +111,14 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
return
;
}
/*
* If we know that the inode will need to be revalidated immediately,
* then don't create a new dentry for it. We'll end up doing an on
* the wire call either way and this spares us an invalidation.
*/
if
(
fattr
->
cf_flags
&
CIFS_FATTR_NEED_REVAL
)
return
;
dentry
=
d_alloc
(
parent
,
name
);
if
(
!
dentry
)
return
;
...
...
sources/3.10/sess.c
View file @
b35deed4
...
...
@@ -198,7 +198,7 @@ static void unicode_domain_string(char **pbcc_area, struct cifs_ses *ses,
bytes_ret
=
0
;
}
else
bytes_ret
=
cifs_strtoUTF16
((
__le16
*
)
bcc_ptr
,
ses
->
domainName
,
256
,
nls_cp
);
CIFS_MAX_DOMAINNAME_LEN
,
nls_cp
);
bcc_ptr
+=
2
*
bytes_ret
;
bcc_ptr
+=
2
;
/* account for null terminator */
...
...
@@ -256,8 +256,8 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
/* copy domain */
if
(
ses
->
domainName
!=
NULL
)
{
strncpy
(
bcc_ptr
,
ses
->
domainName
,
256
);
bcc_ptr
+=
strnlen
(
ses
->
domainName
,
256
);
strncpy
(
bcc_ptr
,
ses
->
domainName
,
CIFS_MAX_DOMAINNAME_LEN
);
bcc_ptr
+=
strnlen
(
ses
->
domainName
,
CIFS_MAX_DOMAINNAME_LEN
);
}
/* else we will send a null domain name
so the server will default to its own domain */
*
bcc_ptr
=
0
;
...
...
sources/3.10/smb2misc.c
View file @
b35deed4
...
...
@@ -413,96 +413,108 @@ cifs_ses_oplock_break(struct work_struct *work)
}
static
bool
smb2_is_valid_lease_break
(
char
*
buffer
,
struct
TCP_Server_Info
*
server
)
smb2_tcon_has_lease
(
struct
cifs_tcon
*
tcon
,
struct
smb2_lease_break
*
rsp
,
struct
smb2_lease_break_work
*
lw
)
{
struct
smb2_lease_break
*
rsp
=
(
struct
smb2_lease_break
*
)
buffer
;
struct
list_head
*
tmp
,
*
tmp1
,
*
tmp2
;
struct
cifs_ses
*
ses
;
struct
cifs_tcon
*
tcon
;
struct
cifsInodeInfo
*
cinode
;
bool
found
;
__u8
lease_state
;
struct
list_head
*
tmp
;
struct
cifsFileInfo
*
cfile
;
struct
cifs_pending_open
*
open
;
struct
smb2_lease_break_work
*
lw
;
bool
found
;
struct
cifsInodeInfo
*
cinode
;
int
ack_req
=
le32_to_cpu
(
rsp
->
Flags
&
SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED
);
lw
=
kmalloc
(
sizeof
(
struct
smb2_lease_break_work
),
GFP_KERNEL
);
if
(
!
lw
)
return
false
;
lease_state
=
smb2_map_lease_to_oplock
(
rsp
->
NewLeaseState
);
INIT_WORK
(
&
lw
->
lease_break
,
cifs_ses_oplock_break
);
lw
->
lease_state
=
rsp
->
NewLeaseState
;
list_for_each
(
tmp
,
&
tcon
->
openFileList
)
{
cfile
=
list_entry
(
tmp
,
struct
cifsFileInfo
,
tlist
);
cinode
=
CIFS_I
(
cfile
->
dentry
->
d_inode
);
cifs_dbg
(
FYI
,
"Checking for lease break
\n
"
);
if
(
memcmp
(
cinode
->
lease_key
,
rsp
->
LeaseKey
,
SMB2_LEASE_KEY_SIZE
))
continue
;
/* look up tcon based on tid & uid */
spin_lock
(
&
cifs_tcp_ses_lock
);
list_for_each
(
tmp
,
&
server
->
smb_ses_list
)
{
ses
=
list_entry
(
tmp
,
struct
cifs_ses
,
smb_ses_list
);
cifs_dbg
(
FYI
,
"found in the open list
\n
"
);
cifs_dbg
(
FYI
,
"lease key match, lease break 0x%d
\n
"
,
le32_to_cpu
(
rsp
->
NewLeaseState
));
spin_lock
(
&
cifs_file_list_lock
);
list_for_each
(
tmp1
,
&
ses
->
tcon_list
)
{
tcon
=
list_entry
(
tmp1
,
struct
cifs_tcon
,
tcon_list
);
smb2_set_oplock_level
(
cinode
,
lease_state
);
cifs_stats_inc
(
&
tcon
->
stats
.
cifs_stats
.
num_oplock_brks
);
list_for_each
(
tmp2
,
&
tcon
->
openFileList
)
{
cfile
=
list_entry
(
tmp2
,
struct
cifsFileInfo
,
tlist
);
cinode
=
CIFS_I
(
cfile
->
dentry
->
d_inode
);
if
(
ack_req
)
cfile
->
oplock_break_cancelled
=
false
;
else
cfile
->
oplock_break_cancelled
=
true
;
if
(
memcmp
(
cinode
->
lease_key
,
rsp
->
LeaseKey
,
SMB2_LEASE_KEY_SIZE
))
continue
;
queue_work
(
cifsiod_wq
,
&
cfile
->
oplock_break
);
kfree
(
lw
);
return
true
;
}
cifs_dbg
(
FYI
,
"found in the open list
\n
"
);
cifs_dbg
(
FYI
,
"lease key match, lease break 0x%d
\n
"
,
le32_to_cpu
(
rsp
->
NewLeaseState
));
found
=
false
;
list_for_each_entry
(
open
,
&
tcon
->
pending_opens
,
olist
)
{
if
(
memcmp
(
open
->
lease_key
,
rsp
->
LeaseKey
,
SMB2_LEASE_KEY_SIZE
))
continue
;
if
(
!
found
&&
ack_req
)
{
found
=
true
;
memcpy
(
lw
->
lease_key
,
open
->
lease_key
,
SMB2_LEASE_KEY_SIZE
);
lw
->
tlink
=
cifs_get_tlink
(
open
->
tlink
);
queue_work
(
cifsiod_wq
,
&
lw
->
lease_break
);
}
smb2_set_oplock_level
(
cinode
,
smb2_map_lease_to_oplock
(
rsp
->
NewLeaseState
));
cifs_dbg
(
FYI
,
"found in the pending open list
\n
"
);
cifs_dbg
(
FYI
,
"lease key match, lease break 0x%d
\n
"
,
le32_to_cpu
(
rsp
->
NewLeaseState
));
if
(
ack_req
)
cfile
->
oplock_break_cancelled
=
false
;
else
cfile
->
oplock_break_cancelled
=
true
;
open
->
oplock
=
lease_state
;
}
return
found
;
}
queue_work
(
cifsiod_wq
,
&
cfile
->
oplock_break
);
static
bool
smb2_is_valid_lease_break
(
char
*
buffer
)
{
struct
smb2_lease_break
*
rsp
=
(
struct
smb2_lease_break
*
)
buffer
;
struct
list_head
*
tmp
,
*
tmp1
,
*
tmp2
;
struct
TCP_Server_Info
*
server
;
struct
cifs_ses
*
ses
;
struct
cifs_tcon
*
tcon
;
struct
smb2_lease_break_work
*
lw
;
spin_unlock
(
&
cifs_file_list_lock
);
spin_unlock
(
&
cifs_tcp_ses_lock
);
return
true
;
}
lw
=
kmalloc
(
sizeof
(
struct
smb2_lease_break_work
),
GFP_KERNEL
);
if
(
!
lw
)
return
false
;
found
=
false
;
list_for_each_entry
(
open
,
&
tcon
->
pending_opens
,
olist
)
{
if
(
memcmp
(
open
->
lease_key
,
rsp
->
LeaseKey
,
SMB2_LEASE_KEY_SIZE
))
continue
;
INIT_WORK
(
&
lw
->
lease_break
,
cifs_ses_oplock_break
);
lw
->
lease_state
=
rsp
->
NewLeaseState
;
if
(
!
found
&&
ack_req
)
{
found
=
true
;
memcpy
(
lw
->
lease_key
,
open
->
lease_key
,
SMB2_LEASE_KEY_SIZE
);
lw
->
tlink
=
cifs_get_tlink
(
open
->
tlink
);
queue_work
(
cifsiod_wq
,
&
lw
->
lease_break
);
}
cifs_dbg
(
FYI
,
"Checking for lease break
\n
"
);
/* look up tcon based on tid & uid */
spin_lock
(
&
cifs_tcp_ses_lock
);
list_for_each
(
tmp
,
&
cifs_tcp_ses_list
)
{
server
=
list_entry
(
tmp
,
struct
TCP_Server_Info
,
tcp_ses_list
);
cifs_dbg
(
FYI
,
"found in the pending open list
\n
"
);
cifs_dbg
(
FYI
,
"lease key match, lease break 0x%d
\n
"
,
le32_to_cpu
(
rsp
->
NewLeaseState
));
list_for_each
(
tmp1
,
&
server
->
smb_ses_list
)
{
ses
=
list_entry
(
tmp1
,
struct
cifs_ses
,
smb_ses_list
);
open
->
oplock
=
smb2_map_lease_to_oplock
(
rsp
->
NewLeaseState
);
}
if
(
found
)
{
spin_unlock
(
&
cifs_file_list_lock
);
spin_unlock
(
&
cifs_tcp_ses_lock
);
return
true
;
spin_lock
(
&
cifs_file_list_lock
);
list_for_each
(
tmp2
,
&
ses
->
tcon_list
)
{
tcon
=
list_entry
(
tmp2
,
struct
cifs_tcon
,
tcon_list
);
cifs_stats_inc
(
&
tcon
->
stats
.
cifs_stats
.
num_oplock_brks
);
if
(
smb2_tcon_has_lease
(
tcon
,
rsp
,
lw
))
{
spin_unlock
(
&
cifs_file_list_lock
);
spin_unlock
(
&
cifs_tcp_ses_lock
);
return
true
;
}
}
spin_unlock
(
&
cifs_file_list_lock
);
}
spin_unlock
(
&
cifs_file_list_lock
);
}
spin_unlock
(
&
cifs_tcp_ses_lock
);
kfree
(
lw
);
...
...
@@ -528,7 +540,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
if
(
rsp
->
StructureSize
!=
smb2_rsp_struct_sizes
[
SMB2_OPLOCK_BREAK_HE
])
{
if
(
le16_to_cpu
(
rsp
->
StructureSize
)
==
44
)
return
smb2_is_valid_lease_break
(
buffer
,
server
);
return
smb2_is_valid_lease_break
(
buffer
);
else
return
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment