Hyunchul Lee [Wed, 26 May 2021 09:59:06 +0000 (18:59 +0900)]
cifsd: lookup a file with LOOKUP_FOLLOW only if 'follow symlinks = yes'
Some vfs help functions lookup a file with
LOOKUP_FOLLOW regardless of the "follow symlinks"
option.
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 09:01:08 +0000 (18:01 +0900)]
cifsd: Prefer kernel type 'u16' over 'uint16_t'
Fix a warning from checkpatch.pl --strict:
CHECK: Prefer kernel type 'u16' over 'uint16_t'
#112: FILE: server.c:112:
+ uint16_t command;
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 08:59:56 +0000 (17:59 +0900)]
cifsd: remove unnecessary parentheses around
Fix warnings from checkpatch.pl --strict :
CHECK: Unnecessary parentheses around 'brk_op->o_lease->new_state ==
SMB2_LEASE_NONE_LE'
#1511: FILE: oplock.c:1511:
+ if (brk_op->is_lease &&
+ (brk_op->o_lease->new_state == SMB2_LEASE_NONE_LE)
&&
+ atomic_read(&brk_op->breaking_cnt))
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 08:57:12 +0000 (17:57 +0900)]
cifsd: Alignment should match open parenthesis
Fix warnings "Alignment should match open parenthesis" from
checkpatch.pl --strict.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 07:45:24 +0000 (16:45 +0900)]
cifsd: Blank lines aren't necessary after an open brace '{'
Blank lines aren't necessary after an open brace '{'.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 07:44:21 +0000 (16:44 +0900)]
cifsd: No space is necessary after a cast
No space is necessary after a cast.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 07:43:31 +0000 (16:43 +0900)]
cifsd: don't use multiple blank lines
don't use multiple blank lines.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 07:42:12 +0000 (16:42 +0900)]
cifsd: spaces preferred around that '/'
Fix "CHECK: paces preferred around that '/' from checkpatch.pl --strict.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 07:40:39 +0000 (16:40 +0900)]
cifsd: braces {} should be used on all arms of this statement
Fix "CHECK: braces {} should be used on all arms of this statement"
from checkpatch.pl --strict.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 07:37:05 +0000 (16:37 +0900)]
cifsd: add the check to prevent potential overflow with smb_strtoUTF16() and UNICODE_LEN()
Add the check to prevent potential overflow with smb_strtoUTF16() and
UNICODE_LEN().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 07:36:15 +0000 (16:36 +0900)]
cifsd: alignment match open parenthesis
Alignment match open parenthesis.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 07:34:56 +0000 (16:34 +0900)]
cifsd: return -ENOMEM about error from ksmbd_crypto_ctx_find_xxx calls
Return -ENOMEM about error from ksmbd_crypto_ctx_find_xxx calls.
And remove unneeded return value print in debug message.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:56:18 +0000 (15:56 +0900)]
cifsd: simplify error handling in ksmbd_gen_preauth_integrity_hash()
Simplify error handling in ksmbd_gen_preauth_integrity_hash().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:55:35 +0000 (15:55 +0900)]
cifsd: call kzalloc() directly instead of wrapper
Call kzalloc() directly instead of wrapper function.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:54:25 +0000 (15:54 +0900)]
cifsd: add default case in switch statment in alloc_shash_desc()
Add default case in switch statment in alloc_shash_desc().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:53:26 +0000 (15:53 +0900)]
cifsd: change success handling to failure handling
Change success handling to failure handling in ksmbd_crypt_message().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:35:26 +0000 (15:35 +0900)]
cifsd: fix wrong return value in ksmbd_crypt_message()
Change error return instead of returning always success return.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:34:37 +0000 (15:34 +0900)]
cifsd: remove unneeded initialization of rc variable in ksmbd_crypt_message()
Remove unneeded initialization of rc variable in ksmbd_crypt_message().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:32:26 +0000 (15:32 +0900)]
cifsd: len can never be negative in ksmbd_init_sg()
Dan pointed out len can not be negative.
This patch remove unneeded negative check in loop.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:31:37 +0000 (15:31 +0900)]
cifsd: add the check if nvec is zero
Dan Carpenter pointed out that memory can be corrupted when nvec is zero.
This patch add the check to prevent it.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:30:50 +0000 (15:30 +0900)]
cifsd: never return 1 on failure
Never return 1 on failure.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:30:04 +0000 (15:30 +0900)]
cifsd: return zero in always success case
Return zero in always success case.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:29:24 +0000 (15:29 +0900)]
cifsd: set error return value for memcmp() difference
Set error return value for memcmp() difference.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:28:48 +0000 (15:28 +0900)]
cifsd: remove unneeded type casting
Remove unneeded type casting.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:28:09 +0000 (15:28 +0900)]
cifsd: simplify error handling in ksmbd_auth_ntlm()
simplify error handling in ksmbd_auth_ntlm().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:27:11 +0000 (15:27 +0900)]
cifsd: move ret check before the out label
Move ret check before the out label.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:26:33 +0000 (15:26 +0900)]
cifsd: just return smbhash() instead of using rc return value
Just return smbhash() instead of using rc return value.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:25:40 +0000 (15:25 +0900)]
cifsd: move fips_enabled check before the str_to_key()
Move fips_enabled check before the str_to_key().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:24:39 +0000 (15:24 +0900)]
cifsd: add goto fail in neg_token_init_mech_type()
Add goto fail in neg_token_init_mech_type().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:23:55 +0000 (15:23 +0900)]
cifsd: use memcmp instead of for loop check in oid_eq()
Use memcmp instead of for loop check in oid_eq().
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 26 May 2021 06:22:37 +0000 (15:22 +0900)]
cifsd: add goto fail in asn1_oid_decode()
Add goto fail in asn1_oid_decode() to clean-up exception handling code.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Wei Yongjun [Thu, 20 May 2021 13:42:11 +0000 (13:42 +0000)]
cifsd: fix build error without CONFIG_OID_REGISTRY
Fix build error when CONFIG_OID_REGISTRY is not set:
mips-linux-gnu-ld: fs/cifsd/asn1.o: in function `gssapi_this_mech':
asn1.c:(.text+0xaa0): undefined reference to `sprint_oid'
mips-linux-gnu-ld: fs/cifsd/asn1.o: in function `neg_token_init_mech_type':
asn1.c:(.text+0xbec): undefined reference to `sprint_oid'
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 18 May 2021 01:37:59 +0000 (10:37 +0900)]
cifsd: add support for FSCTL_DUPLICATE_EXTENTS_TO_FILE
Add support for FSCTL_DUPLICATE_EXTENTS_TO_FILE in smb2 ioctl.
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Tue, 18 May 2021 01:29:25 +0000 (10:29 +0900)]
cifsd: Do not use 0 or 0xFFFFFFFF for TreeID
Returning TreeID=0 is valid behaviour according to [MS-SMB2] 2.2.1.2:
TreeId (4 bytes): Uniquely identifies the tree connect for the command.
This MUST be 0 for the SMB2 TREE_CONNECT Request. The TreeId can be
any unsigned 32-bit integer that is received from a previous
SMB2 TREE_CONNECT Response. TreeId SHOULD be set to 0 for the
following commands:
[...]
However, some client implementations reject it as invalid. Windows10
assigns ids starting from 1, and samba4 returns a random uint32_t
which suggests there may be other clients that consider it is
invalid behaviour.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 14 May 2021 03:20:07 +0000 (12:20 +0900)]
cifsd: fix xfstests generic/504 test failure
If lock length in smb2 lock request from client is over
flock max length size, lock length is changed to flock max length
and don't return error response.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
kernel test robot [Wed, 12 May 2021 00:24:37 +0000 (09:24 +0900)]
cifsd: fix boolreturn.cocci warnings
fs/cifsd/smb2pdu.c:8098:8-9: WARNING: return of 0/1 in function
'smb2_is_sign_req' with return type bool
Return statements in functions returning bool should use true/false
instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 21 Apr 2021 03:35:38 +0000 (12:35 +0900)]
cifsd: fix build break from asn1
build break from asn1 happened on some environment.
CHECK /home/smfrench/smb3-kernel/fs/cifsd/smb2misc.c
CC [M] /home/smfrench/smb3-kernel/fs/cifsd/asn1.o
/home/smfrench/smb3-kernel/fs/cifsd/asn1.c:21:10: fatal error:
spnego_negtokeninit.asn1.h: No such file or directory
21 | #include "spnego_negtokeninit.asn1.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.build:271:
/home/smfrench/smb3-kernel/fs/cifsd/asn1.o] Error 1
make: *** [Makefile:1857: /home/smfrench/smb3-kernel/fs/cifsd] Error 2
make: Leaving directory
'/usr/src/linux-headers-5.12.0-051200rc8-generic'
This patch fix that asn1 compiler build *.asn1 file before compiling
asn.c
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 20 Apr 2021 05:25:35 +0000 (14:25 +0900)]
cifsd: fix WARNING: Too many leading tabs
WARNING: Too many leading tabs - consider code refactoring
3066: FILE: fs/cifsd/smb2pdu.c:2733:
+ if (fattr.cf_dacls)
Fix a warning from checkpatch.pl.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 20 Apr 2021 05:24:28 +0000 (14:24 +0900)]
cifsd: fix WARNING: Possible unnecessary 'out of memory' message
WARNING: Possible unnecessary 'out of memory' message
902: FILE: fs/cifsd/smb2pdu.c:569:
+ if (!work->response_buf) {
+ ksmbd_err("Failed to allocate %zu bytes buffer\n", sz);
Fix a warning from checkpatch.pl.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Mon, 19 Apr 2021 08:26:15 +0000 (17:26 +0900)]
cifsd: decoding gss token using lib/asn1_decoder.c
Decode gss token of SMB2_SESSSION_SETUP using
lib/asn1_decoder.c
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Mon, 10 May 2021 00:08:19 +0000 (09:08 +0900)]
cifsd: fix invalid memory access in smb2_write()
Add missing fp initialzation to prevent invalid memory access in
smb2_write().
Reported-by: Coverity Scan <scan-admin@coverity.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Thu, 6 May 2021 02:43:37 +0000 (11:43 +0900)]
cifsd: add support for AES256 encryption
Now that 256 bit encryption can be negotiated, update
names of the nonces to match the updated official protocol
documentation (e.g. AES_GCM_NONCE instead of AES_128GCM_NONCE)
since they apply to both 128 bit and 256 bit encryption.
update smb encryption code to set 32 byte key length and to
set gcm256/ccm256 when requested on mount.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Thu, 6 May 2021 02:41:54 +0000 (11:41 +0900)]
cifsd: Fix potential null-ptr-deref in destroy_previous_session()
The user field in the session structure is allocated when the client is
authenticated. If the client explicitly logs off, the user field is freed,
but the session is kept around in case the user reconnects. If the TCP
connection hasn't been closed and the client sends a session setup with
a PreviousSessionId set, destroy_previous_session() will be called to
check if the session needs to be cleaned up.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Thu, 6 May 2021 02:40:02 +0000 (11:40 +0900)]
cifsd: Update out_buf_len in smb2_populate_readdir_entry()
When processing a SMB2 QUERY_DIRECTORY request,
smb2_populate_readdir_entry() is called first to fill the dot/dotdot
entries. This moves the d_info->wptr pointer but out_buf_len remains
unchanged. As a result, reserve_populate_dentry() may end up writing
past the end of the buffer since the bounds checking is done on
invalid values.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Thu, 6 May 2021 02:38:35 +0000 (11:38 +0900)]
cifsd: Handle ksmbd_session_rpc_open() failure in create_smb2_pipe()
Currently, a SMB2 client does not receive an error message if
ksmbd_session_rpc_open() fails when opening a pipe.
Fix this by responding with STATUS_NO_MEMORY or STATUS_INVALID_PARAMETER
depending on the error that occurred.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Thu, 6 May 2021 02:34:52 +0000 (11:34 +0900)]
cifsd: Call smb2_set_err_rsp() in smb2_read/smb2_write error path
Call smb2_set_err_rsp() in smb2_read/smb2_write error path.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 28 Apr 2021 04:17:47 +0000 (13:17 +0900)]
cifsd: add ksmbd/nfsd interoperability to feature table
Add ksmbd/nfsd interoperability to feature table and sync with a table in
patch cover letter.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Sebastian Gottschall [Tue, 27 Apr 2021 06:33:54 +0000 (15:33 +0900)]
cifsd: Fix regression in smb2_get_info
a Windows 10 client isn't able to store files from ksmbd servers due
unknown local permission problems (code 0x8007003A) if smb3 encryption
is enabled. Windows 10 is requesting for ATTRIBUTE_SECINFO (mask 0x20)
which is not yet handled by ksmbd, this leads to a invalid response.
For now we just reintroduce the old check to avoid processing of unhandled
flags until ATTRIBUTE_SECINFO is properly handled.
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Tue, 27 Apr 2021 06:30:22 +0000 (15:30 +0900)]
cifsd: Remove is_attributes_write_allowed() wrapper
Inline it in the only place it is used and remove it.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Tue, 27 Apr 2021 06:29:01 +0000 (15:29 +0900)]
cifsd: Update access check in set_file_allocation_info/set_end_of_file_info
[MS-SMB2] 3.3.5.21.1
If the object store supports security and FileInfoClass is
FileAllocationInformation, FileEndOfFileInformation, or
FileValidDataLengthInformation, and Open.GrantedAccess does not
include FILE_WRITE_DATA, the server MUST fail the request with
STATUS_ACCESS_DENIED.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 16 Apr 2021 05:12:06 +0000 (14:12 +0900)]
cifsd: remove the dead code of unimplemented durable handle
Remove the dead code of unimplemented durable handle.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Thu, 15 Apr 2021 01:29:39 +0000 (10:29 +0900)]
cifsd: use d_inode()
Use d_inode().
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Thu, 15 Apr 2021 01:24:56 +0000 (10:24 +0900)]
cifsd: Fix potential null-ptr-deref in smb2_open()
Fix potential null-ptr-deref in smb2_open().
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 14 Apr 2021 00:24:11 +0000 (09:24 +0900)]
cifsd: move nt time functions to misc.c
Move nt time functions in netmisc.c to misc.c to remove netmisc.c file.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Wed, 14 Apr 2021 00:16:27 +0000 (09:16 +0900)]
cifsd: remove unused nterr.c file
Remove unused nterr.c file.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 13 Apr 2021 08:26:02 +0000 (17:26 +0900)]
cifsd: remove unused smberr.h
smberr.h is a leftover of SMB1. This patch remove unused smberr.h.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Marios Makassikis [Tue, 13 Apr 2021 04:25:57 +0000 (13:25 +0900)]
cifsd: Remove smb2_put_name()
smb2_put_name() is called twice, and both call sites do the IS_ERR() check
before.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Tue, 13 Apr 2021 04:24:43 +0000 (13:24 +0900)]
cifsd: fix reference count decrement of unclaimed file in __ksmbd_lookup_fd
__ksmbd_lookup_fd could decrement the reference count of
unclaimed ksmbd_file to 0 but not release this ksmbd_file.
ksmbd_file cannot be unclaimed except ksmbd_close_inode_fds(),
because ksmbd_file is only removed from the m_fp_list list
after the reference count of ksmbd_file becomes 0. And if the
count is 0, __ksmbd_lookup_fd does not use ksmbd_file found
from idr due to atomic_inc_not_zero.
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Tue, 13 Apr 2021 04:22:31 +0000 (13:22 +0900)]
cifsd: re-implement ksmbd_vfs_kern_path
re-implement ksmbd_vfs_kern_path() to change
recursion to iteration.
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 13 Apr 2021 04:20:52 +0000 (13:20 +0900)]
cifsd: get parent dentry from child in ksmbd_vfs_remove_file()
To remove the file, We have parsed full pathname to divide parent path and
filename. It is a better way to get parent dentry from child dentry that
obtained by lookup with given pathname.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 13 Apr 2021 04:18:10 +0000 (13:18 +0900)]
cifsd: add the check if parent is stable by unexpected rename
This patch add the check if parent is stable by unexpected rename.
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 13 Apr 2021 04:06:30 +0000 (13:06 +0900)]
cifsd: declare ida statically
Matthew pointed out that embedding struct ida into the struct is
better than having a pointer to it.
This patch initialise it statically using DEFINE_IDA() or ida_init()
and remove ksmbd_ida_alloc/free().
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Tian Tao [Thu, 8 Apr 2021 08:05:21 +0000 (17:05 +0900)]
cifsd: remove unused including <linux/version.h>
Remove including <linux/version.h> that don't need it.
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Zhang Xiaoxu [Wed, 7 Apr 2021 04:08:07 +0000 (13:08 +0900)]
cifsd: Select SG_POOL for SMB_SERVER_SMBDIRECT
hulk-robot following build error:
fs/cifsd/transport_rdma.c: In function 'read_write_done':
fs/cifsd/transport_rdma.c:1297:2: error: implicit declaration of
function 'sg_free_table_chained'
[-Werror=implicit-function-declaration]
1297 | sg_free_table_chained(&msg->sgt, SG_CHUNK_SIZE);
The reason is CONFIG_SG_POOL is not enabled in the config, to
avoid such failure, select SG_POOL in Kconfig for SMB_SERVER_SMBDIRECT.
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Sun, 4 Apr 2021 08:52:58 +0000 (17:52 +0900)]
cifsd: prevent a integer overflow in wm_alloc()
Dan Carpenter pointed out that there there is a possibility of
integer overflow. This patch prevent a integer overflow in wm_alloc().
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Mauro Carvalho Chehab [Fri, 2 Apr 2021 04:17:04 +0000 (13:17 +0900)]
doc: cifsd: change the reference to configuration.txt
added documentation for cifsd. There, it points to a file
named:
Documentation/configuration.txt
This confuses Kernel scripts, as they think that this is a
document within the Kernel tree, instead of a file from
some other place.
Replace it by an hyperlink to the ksmbd-tools tree, in order
to avoid false-positives.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 2 Apr 2021 03:47:14 +0000 (12:47 +0900)]
cifsd: remove wrappers of kvmalloc/kvfree
Do directly call kvmalloc/kvfree().
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
kernel test robot [Fri, 2 Apr 2021 03:17:24 +0000 (12:17 +0900)]
cifsd: fix memdup.cocci warnings
fs/cifsd/smb2pdu.c:1177:27-34: WARNING opportunity for kmemdup
Use kmemdup rather than duplicating its implementation
Generated by: scripts/coccinelle/api/memdup.cocci
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Muhammad Usama Anjum [Fri, 2 Apr 2021 00:25:35 +0000 (09:25 +0900)]
cifsd: use kfree to free memory allocated by kmalloc or kzalloc
kfree should be used to free memory allocated by kmalloc or kzalloc to
avoid any overhead and for maintaining consistency.
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Muhammad Usama Anjum [Thu, 1 Apr 2021 08:54:43 +0000 (17:54 +0900)]
cifsd: fix memory leak when loop ends
Memory is being allocated and if veto_list is zero, the loop breaks
without cleaning up the allocated memory. In this patch, the length
check has been moved before allocation. If loop breaks, the memory isn't
allocated in the first place. Thus the memory is being protected from
leaking.
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1503590 ("Resource leaks")
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Gibeom Kim [Thu, 1 Apr 2021 08:52:46 +0000 (17:52 +0900)]
cifsd: remove stale prototype and variables
Remove unused function prototype and variables.
Signed-off-by: Gibeom Kim <gibeomii.kim@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Thu, 1 Apr 2021 08:45:33 +0000 (17:45 +0900)]
cifsd: use xarray instead of linked list for tree connect list
Matthew suggest to change linked list of tree connect list to xarray.
It will be tree connect lookup in O(log(n)) time instead of O(n) time.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Thu, 1 Apr 2021 08:47:19 +0000 (17:47 +0900)]
cifsd: remove useless error handling in ksmbd_vfs_read
dentry->d_inode never happen to be NULL if we hold the dentry.
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Thu, 1 Apr 2021 08:33:47 +0000 (17:33 +0900)]
cifsd: use file_inode() instead of d_inode()
use file_inode() to get layerd filesystems right.
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Thu, 1 Apr 2021 08:32:24 +0000 (17:32 +0900)]
cifsd: handle unhashed dentry in ksmbd_vfs_mkdir
vfs_mkdir could return the dentry left unhashed negative on success.
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Thu, 1 Apr 2021 08:23:21 +0000 (17:23 +0900)]
cifsd: remove calling d_path in error paths
calling d_path is excessive in error paths.
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Thu, 1 Apr 2021 08:29:23 +0000 (17:29 +0900)]
cifsd: remove smack inherit leftovers
smack inherit was added for internal product beofre.
It is no longer used. This patch remove it's left overs.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 05:49:16 +0000 (14:49 +0900)]
cifsd: fix implicit declaration of function 'locks_alloc_lock'
Randy reported build failure:
../fs/cifsd/smb2pdu.c:6655:7: error: implicit declaration of function
'locks_alloc_lock'; did you mean 'locks_copy_lock'?
This patch add depend on FILE_LOCKING.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 05:43:16 +0000 (14:43 +0900)]
cifsd: fix implicit declaration of function 'groups_alloc'
kernel test robot reported:
fs/cifsd/smb_common.c: In function 'ksmbd_override_fsids':
>> fs/cifsd/smb_common.c:613:7: error: implicit declaration of function
>> 'groups_alloc'; did you mean 'cgroup_sk_alloc'?
>> [-Werror=implicit-function-declaration]
613 | gi = groups_alloc(0);
| ^~~~~~~~~~~~
| cgroup_sk_alloc
fs/cifsd/smb_common.c:613:5: warning: assignment to 'struct
group_info *' from 'int' makes pointer from integer without a cast
[-Wint-conversion]
613 | gi = groups_alloc(0);
| ^
>> fs/cifsd/smb_common.c:618:2: error: implicit declaration of function
>> 'set_groups'; did you mean 'get_cgroup_ns'?
>> [-Werror=implicit-function-declaration]
618 | set_groups(cred, gi);
| ^~~~~~~~~~
| get_cgroup_ns
cc1: some warnings being treated as errors
This patch add depends on MULTIUSER.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 05:42:05 +0000 (14:42 +0900)]
cifsd: fix wrong prototype in comment
kernel test robot reported:
>> fs/cifsd/oplock.c:1454: warning: expecting prototype for
create_durable_rsp__buf(). Prototype was for
create_durable_rsp_buf() instead
This patch fix wrong prototype in comment.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 05:56:26 +0000 (14:56 +0900)]
cifsd: merge time_wrappers.h into smb_common.h
This patch merge time_wrappers.h into smb_common.h.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 05:25:35 +0000 (14:25 +0900)]
cifsd: clean-up codes using chechpatch.pl --strict
Dan Carpenter suggested to run chechpatch.pl --strict on ksmbd to fix
check warnings. This patch does not fix all warnings but only things that
I can understand.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 03:58:26 +0000 (12:58 +0900)]
cifsd: fix error return code in ksmbd_vfs_remove_file()
Change -ENOENT error to -EINVAL to response STATUS_INVALID_PARAMETER.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 03:43:18 +0000 (12:43 +0900)]
cifsd: add the check to work file lock and rename behaviors like Windows unless POSIX extensions are negotiated
This patch add the check to work file lock and rename behaviors
like Windows if POSIX extensions are not negotiated.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 03:40:47 +0000 (12:40 +0900)]
cifsd: use kmalloc() for small allocations
Just use kmalloc() for small allocations.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 03:38:03 +0000 (12:38 +0900)]
cifsd: fix wrong use of rw semaphore in __session_create()
Adding list to session table should be protected by
down_write/up_write().
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 30 Mar 2021 03:35:23 +0000 (12:35 +0900)]
cifsd: remove unneeded macros
Remove unneeded RESPONSE_BUF, REQUEST_BUF, RESPONSE_SZ, INIT_AUX_PAYLOAD,
HAS_AUX_PAYLOAD, AUX_PAYLOAD, AUX_PAYLOAD_SIZE, RESP_HDR_SIZE,
HAS_TRANSFORM_BUF and TRANSFORM_BUF macros.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Colin Ian King [Thu, 25 Mar 2021 17:35:38 +0000 (17:35 +0000)]
cifsd: remove redundant assignment to variable err
The variable err is being initialized with a value that is never read
and it is being updated later with a new value. The initialization is
redundant and can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Dan Carpenter [Tue, 23 Mar 2021 13:27:04 +0000 (16:27 +0300)]
cifsd: fix error handling in ksmbd_server_init()
The error handling in ksmbd_server_init() uses "one function to free
everything style" which is impossible to audit and leads to several
canonical bugs. When we free something that wasn't allocated it may be
uninitialized, an error pointer, freed in a different function or we
try freeing "foo->bar" when "foo" is a NULL pointer. And since the
code is impossible to audit then it leads to memory leaks.
In the ksmbd_server_init() function, every goto will lead to a crash
because we have not allocated the work queue but we call
ksmbd_workqueue_destroy() which tries to flush a NULL work queue.
Another bug is if ksmbd_init_buffer_pools() fails then it leads to a
double free because we free "work_cache" twice. A third type of bug is
that we forgot to call ksmbd_release_inode_hash() so that is a resource
leak.
A better way to write error handling is for every function to clean up
after itself and never leave things partially allocated. Then we can
use "free the last successfully allocated resource" style. That way
when someone is reading the code they can just track the last resource
in their head and verify that the goto matches what they expect.
In this patch I modified ksmbd_ipc_init() to clean up after itself and
then I converted ksmbd_server_init() to use gotos to clean up.
Fixes:
cabcebc31de4 ("cifsd: introduce SMB3 kernel server")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Dan Carpenter [Mon, 22 Mar 2021 14:50:11 +0000 (17:50 +0300)]
cifsd: Fix an error code in smb2_read()
This code is assigning the wrong variable to "err" so it returns
zero/success instead of -ENOMEM.
Fixes:
788b6f45c1d2 ("cifsd: add server-side procedures for SMB3")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 23 Mar 2021 06:17:00 +0000 (15:17 +0900)]
cifsd: fix build warnings from cifsd.rst
Stephen reported a build warnings from cifsd.rst:
Documentation/filesystems/cifs/cifsd.rst:13: WARNING: Inline
substitution_reference start-string without end-string.
Documentation/filesystems/cifs/cifsd.rst:14: WARNING: Block quote ends
without a blank line; unexpected unindent.
Documentation/filesystems/cifs/cifsd.rst:14: WARNING: Inline
substitution_reference start-string without end-string.
Documentation/filesystems/cifs/cifsd.rst:18: WARNING: Block quote ends
without a blank line; unexpected unindent.
Documentation/filesystems/cifs/cifsd.rst:23: WARNING: Inline
substitution_reference start-string without end-string.
Documentation/filesystems/cifs/cifsd.rst:23: WARNING: Inline
substitution_reference start-string without end-string.
Documentation/filesystems/cifs/cifsd.rst:24: WARNING: Inline
substitution_reference start-string without end-string.
Documentation/filesystems/cifs/cifsd.rst:25: WARNING: Definition list
ends without a blank line; unexpected unindent.
Documentation/filesystems/cifs/cifsd.rst:28: WARNING: Unexpected
indentation.
Documentation/filesystems/cifs/cifsd.rst:31: WARNING: Block quote ends
without a blank line; unexpected unindent.
Documentation/filesystems/cifs/cifsd.rst:38: WARNING: Unexpected
indentation.
Documentation/filesystems/cifs/cifsd.rst:32: WARNING: Inline
substitution_reference start-string without end-string.
Documentation/filesystems/cifs/cifsd.rst:32: WARNING: Inline
substitution_reference start-string without end-string.
Documentation/filesystems/cifs/cifsd.rst:39: WARNING: Block quote ends
without a blank line; unexpected unindent.
Documentation/filesystems/cifs/cifsd.rst:14: WARNING: Undefined
substitution referenced: "--- ksmbd/3 - Client 3 |-------".
Documentation/filesystems/cifs/cifsd.rst:0: WARNING: Undefined
substitution referenced:
"____________________________________________________".
Documentation/filesystems/cifs/cifsd.rst:25: WARNING: Undefined
substitution referenced: "--- ksmbd/0(forker kthread) ---------------|".
Documentation/filesystems/cifs/cifsd.rst:32: WARNING: Undefined
substitution referenced:
"______________________________________________".
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Sun, 21 Mar 2021 08:32:19 +0000 (17:32 +0900)]
cifsd: Pass string length parameter to match_pattern()
When iterating through a directory, a file's name may not be
null-terminated (depending on the underlying filesystem implementation).
Modify match_pattern to take the string's length into account when matching
it against the request pattern.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Sun, 21 Mar 2021 08:30:49 +0000 (17:30 +0900)]
cifsd: fix warning: variable 'total_ace_size' and 'posix_ccontext' set but not used
kernel test robot reported warnings:
fs/cifsd/smbacl.c: In function 'parse_sec_desc':
>> fs/cifsd/smbacl.c:786:6: warning: variable 'total_ace_size' set but
not used [-Wunused-but-set-variable]
786 | int total_ace_size = 0, pntsd_type;
| ^~~~~~~~~~~~~~
--
fs/cifsd/smb2pdu.c: In function 'smb2_open':
>> fs/cifsd/smb2pdu.c:3285:26: warning: variable 'posix_ccontext' set but
not used [-Wunused-but-set-variable]
3285 | struct create_context *posix_ccontext;
| ^~~~~~~~~~~~~~
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Sun, 21 Mar 2021 08:05:56 +0000 (17:05 +0900)]
cifsd: fix incorrect comments
kernel test bot reports some incorrect comments.
This patch fixes these comments.
Reported-by: kernel test bot <lkp@intel.com>
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Sergey Senozhatsky [Sat, 20 Mar 2021 07:23:22 +0000 (16:23 +0900)]
cifsd: remove unneeded FIXME comments
Remove unneeded FIXME comments.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Sat, 20 Mar 2021 07:19:01 +0000 (16:19 +0900)]
cifsd: add index.rst in cifs documentation
Since more than one file is in the cifs document directory,
This patch add an index.rst.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Sat, 20 Mar 2021 07:06:59 +0000 (16:06 +0900)]
cifsd: update cifsd.rst document
Add work flow of cifsd and feature stats table.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 19 Mar 2021 04:52:12 +0000 (13:52 +0900)]
cifsd: fix static checker warning from smb_check_perm_dacl()
Dan reported static checker warning:
fs/cifsd/smbacl.c:1140 smb_check_perm_dacl()
error: we previously assumed 'pntsd' could be null (see line 1137)
This patch validate bounds of pntsd buffer.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 19 Mar 2021 04:51:15 +0000 (13:51 +0900)]
cifsd: fix static checker warning from smb_direct_post_send_data()
Dan reported static checker warning:
fs/cifsd/transport_rdma.c:1168 smb_direct_post_send_data()
warn: missing error code 'ret'
This patch add missing ret error code.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Dan Carpenter [Thu, 18 Mar 2021 13:12:54 +0000 (16:12 +0300)]
cifsd: Fix a use after free on error path
The ksmbd_free_work_struct() frees "work" so we need to swap the order
of these two function calls to avoid a use after free.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>