Hyunchul Lee [Thu, 24 Jun 2021 22:02:09 +0000 (07:02 +0900)]
ksmbd: replace PAYLOAD_HEAD with inline function
Replace PAYLOAD_HEAD with inline function.
Reviewed-by: Christoph Hellwig <hch@lst.de>
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, 24 Jun 2021 22:02:08 +0000 (07:02 +0900)]
ksmbd: replace KSMBD_ALIGN with kernel ALIGN macro
Replace KSMBD_ALIGN with kernel ALIGN macro
Reviewed-by: Christoph Hellwig <hch@lst.de>
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, 24 Jun 2021 22:02:07 +0000 (07:02 +0900)]
ksmbd: replace BUFFER_NR_PAGES with inline function
Replace BUFFER_NR_PAGES with inline function
Reviewed-by: Christoph Hellwig <hch@lst.de>
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, 24 Jun 2021 22:02:06 +0000 (07:02 +0900)]
ksmbd: remove macros in transport_ipc.c
Remove macros in transport_ipc.c
Reviewed-by: Christoph Hellwig <hch@lst.de>
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 [Wed, 23 Jun 2021 04:48:24 +0000 (13:48 +0900)]
ksmbd: set MAY_* flags together with open flags
set MAY_* flags together with open flags and
remove ksmbd_vfs_inode_permission().
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 [Wed, 23 Jun 2021 02:07:43 +0000 (11:07 +0900)]
ksmbd: factor out a ksmbd_vfs_lock_parent helper
Factor out a self-contained helper to
get stable parent 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>
Namjae Jeon [Thu, 24 Jun 2021 00:20:03 +0000 (09:20 +0900)]
MAINTAINERS: rename cifsd to ksmbd
Rename cifsd to ksmbd and update Sergey's mail address.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Thu, 24 Jun 2021 01:34:11 +0000 (10:34 +0900)]
ksmbd: move fs/cifsd to fs/ksmbd
Move fs/cifsd to fs/ksmbd and rename the remaining cifsd name to ksmbd.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 22 Jun 2021 07:20:47 +0000 (16:20 +0900)]
ksmbd: use f_bsize in FS_SECTOR_SIZE_INFORMATION
Use f_bsize in FS_SECTOR_SIZE_INFORMATION to avoid the access the block
layer.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 22 Jun 2021 07:16:45 +0000 (16:16 +0900)]
ksmbd: remove unneeded NULL check in the list iterator
Remove unneeded NULL check in the list iterator. And use
list_for_each_entry_safe instead of list_for_each_safe.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Sat, 26 Jun 2021 13:32:34 +0000 (22:32 +0900)]
ksmbd: use f_bsize instead of q->limits.logical_block_size
Use f_bsize instead of q->limits.logical_block_size.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 22 Jun 2021 04:26:24 +0000 (13:26 +0900)]
ksmbd: change stream type macro to enumeration
Change stream type macro to enumeration and move it to vfs.h.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 22 Jun 2021 02:42:29 +0000 (11:42 +0900)]
ksmbd: opencode posix acl functions instead of wrappers
Add select FS_POSIX_ACL in Kconfig and then opencode posix acl functions
instead of wrappers
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:20:24 +0000 (10:20 +0900)]
ksmbd: factor out a ksmbd_validate_entry_in_use helper from __ksmbd_vfs_rename
Factor out a self-contained helper to find sub file/dir in use.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 22 Jun 2021 02:06:11 +0000 (11:06 +0900)]
ksmbd: opencode to avoid trivial wrappers
Opencode to avoid trivial wrappers that just make the code hard to
follow.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Mon, 28 Jun 2021 06:23:19 +0000 (15:23 +0900)]
ksmbd: remove ksmbd_err/info
Use the pr_fmt built into pr_*. and use pr_err/info after removing
wrapper ksmbd_err/info.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:42:32 +0000 (10:42 +0900)]
ksmbd: replace KSMBD_SHARE_CONFIG_PATH with inline function
replace KSMBD_SHARE_CONFIG_PATH with inline function.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:41:42 +0000 (10:41 +0900)]
ksmbd: remove ____ksmbd_align in ksmbd_server.h
None of structures needs the attribute.
So remove ____ksmbd_align in ksmbd_server.h.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:40:56 +0000 (10:40 +0900)]
ksmbd: remove unneeded FIXME comment
Remove unneeded FIXME comment.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:30:46 +0000 (10:30 +0900)]
ksmbd: fix overly long line
Fix overly long line.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:29:56 +0000 (10:29 +0900)]
ksmbd: use goto instead of duplicating the resoure cleanup in ksmbd_open_fd
Use goto instead of duplicating the resoure cleanup in ksmbd_open_fd.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:28:52 +0000 (10:28 +0900)]
ksmbd: use list_for_each_entry instead of list_for_each
Use list_for_each_entry instead of list_for_each.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:28:00 +0000 (10:28 +0900)]
ksmbd: remove ksmbd_vfs_copy_file_range
vfs_copy_file_range and cifs client already does this type of fallback,
so this is dead code.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:18:34 +0000 (10:18 +0900)]
ksmbd: initialize variables on the declaration
Initialize variables on the declaration.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:17:37 +0000 (10:17 +0900)]
ksmbd: remove cache read/trans buffer support
As vmalloc performance improvement patch for big allocation is merged into
linux kernel, This feature is no longer not needed.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Fri, 18 Jun 2021 01:04:19 +0000 (10:04 +0900)]
ksmbd: add support for SMB3 multichannel
Add support for SMB3 multichannel. It will be enable by setting
'server multi channel support = yes' in smb.conf.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Colin Ian King [Fri, 18 Jun 2021 00:54:53 +0000 (09:54 +0900)]
ksmbd: fix kfree of uninitialized pointer oid
Currently function ksmbd_neg_token_init_mech_type can kfree an
uninitialized pointer oid when the call to asn1_oid_decode fails when
vlen is out of range. All the other failure cases in function
asn1_oid_decode set *oid to NULL on an error, so fix the issue by
ensuring the vlen out of range error also nullifies the pointer.
Addresses-Coverity: ("Uninitialized pointer read")
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>
Hyunchul Lee [Wed, 9 Jun 2021 01:06:57 +0000 (10:06 +0900)]
cifsd: append ksmbd prefix into names for asn1 decoder
Because functions and variables generated from
ASN1 compiler aren't static, append ksmbd prefix
into thoses to avoid link errors.
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>
Wan Jiabing [Mon, 7 Jun 2021 04:54:32 +0000 (12:54 +0800)]
cifsd: remove duplicated argument
Fix the following coccicheck warning:
./fs/cifsd/smb2pdu.c:1713:27-41: duplicated argument to & or |
FILE_DELETE_LE is duplicated. Remove one and reorder argument to
make coding style reasonable.
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Sun, 6 Jun 2021 02:42:25 +0000 (11:42 +0900)]
cifsd: fix possible compile error for asn1.c
spnego_negtokeninit.asn1.h and spnego_negtokentarg.asn1.h
have to be generated before asn1.o is compiled.
Because of parallel build, the dependency could be broken,
we need to specify the dependency in Makefile.
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, 7 Jun 2021 00:22:22 +0000 (09:22 +0900)]
cifsd: set epoch in smb2_lease_break response
When running generic/591 after smb2 leases is enable, all smb2 lease ack
requests failed in ksmbd. because cifs client seems to support only smb2
v2 lease. So cifs doesn't update lease state in ack request if epoch is
not set in smb2 lease break request from ksmbd. epoch is used for smb2
v2 leases. So this patch add smb2 create v2 lease context and set
increased epoch in smb2 lease break response.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Mon, 7 Jun 2021 00:08:45 +0000 (09:08 +0900)]
cifsd: fix list_add double add BUG_ON trap in setup_async_work()
BUG_ON trap is coming when running xfstests generic/591 and
smb2 leases = yes in smb.conf.
[ 597.224978] list_add double add: new=
ffff9110d292bb20,
prev=
ffff9110d292bb20, next=
ffff9110d6c389e8.
[ 597.225073] ------------[ cut here ]------------
[ 597.225077] kernel BUG at lib/list_debug.c:31!
[ 597.225090] invalid opcode: 0000 [#1] SMP PTI
[ 597.225095] CPU: 2 PID: 501 Comm: kworker/2:3 Tainted: G OE
5.13.0-rc1+ #2
[ 597.225099] Hardware name: SAMSUNG ELECTRONICS CO., LTD. Samsung
DeskTop System/SAMSUNG_DT1234567890, BIOS P04KBM.022.121023.SK
10/23/2012
[ 597.225102] Workqueue: ksmbd-io handle_ksmbd_work [ksmbd]
[ 597.225125] RIP: 0010:__list_add_valid+0x66/0x70
[ 597.225132] Code: 0b 48 89 c1 4c 89 c6 48 c7 c7 c8 08 c0 95 e8 fd 54
66 00 0f 0b 48 89 f2 4c 89 c1 48 89 fe 48 c7 c7 20 09 c0 95 e8 e6 54 66
00 <0f> 0b 0f 1f 84 00 00 00 00 00 55 48 8b 07 48 b9 00 01 00 00 00 00
[ 597.225136] RSP: 0018:
ffffb9c9408dbac0 EFLAGS:
00010282
[ 597.225139] RAX:
0000000000000058 RBX:
ffff9110d292ba40 RCX:
0000000000000000
[ 597.225142] RDX:
0000000000000000 RSI:
ffff9111da328c30 RDI:
ffff9111da328c30
[ 597.225144] RBP:
ffffb9c9408dbac0 R08:
0000000000000001 R09:
0000000000000001
[ 597.225147] R10:
0000000003dd35ed R11:
ffffb9c9408db888 R12:
ffff9110d6c38998
[ 597.225149] R13:
ffff9110d6c38800 R14:
ffff9110d292bb20 R15:
ffff9110d292bb20
[ 597.225152] FS:
0000000000000000(0000) GS:
ffff9111da300000(0000)
knlGS:
0000000000000000
[ 597.225155] CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
[ 597.225157] CR2:
00007fd1629f84d0 CR3:
00000000c9a12006 CR4:
00000000001706e0
[ 597.225160] Call Trace:
[ 597.225163] setup_async_work+0xa2/0x120 [ksmbd]
[ 597.225191] oplock_break+0x396/0x5d0 [ksmbd]
[ 597.225206] smb_grant_oplock+0x7a1/0x900 [ksmbd]
[ 597.225218] ? smb_grant_oplock+0x7a1/0x900 [ksmbd]
[ 597.225231] smb2_open+0xbbb/0x2960 [ksmbd]
[ 597.225243] ? smb2_open+0xbbb/0x2960 [ksmbd]
[ 597.225257] ? find_held_lock+0x35/0xa0
[ 597.225261] ? xa_load+0xaf/0x160
[ 597.225268] handle_ksmbd_work+0x2e0/0x420 [ksmbd]
[ 597.225280] ? handle_ksmbd_work+0x2e0/0x420 [ksmbd]
[ 597.225292] process_one_work+0x25a/0x5d0
[ 597.225298] worker_thread+0x3f/0x3a0
[ 597.225302] ? __kthread_parkme+0x6f/0xa0
[ 597.225306] ? process_one_work+0x5d0/0x5d0
[ 597.225309] kthread+0x142/0x160
[ 597.225313] ? kthread_park+0x90/0x90
[ 597.225316] ret_from_fork+0x22/0x30
same work struct can be add to list in smb_break_all_write_oplock() and
smb_grant_oplock(). If client send invalid lease break ack to server,
This issue can occur by calling both functions.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Tue, 1 Jun 2021 04:18:44 +0000 (13:18 +0900)]
cifsd: fix additional warnings from checkpatch.pl --strict
Fix additional warnings from checkpatch.pl --strict.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Namjae Jeon [Mon, 31 May 2021 08:26:43 +0000 (17:26 +0900)]
cifsd: fix potential read overflow in ksmbd_vfs_stream_read()
If *pos or *pos + count is greater than v_len, It will read beyond
the stream_buf buffer. This patch add the check and cut down count with
size of the buffer.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Yang Yingliang [Mon, 31 May 2021 08:25:05 +0000 (17:25 +0900)]
cifsd: check return value of ksmbd_vfs_getcasexattr() correctly
If ksmbd_vfs_getcasexattr() returns -ENOMEM, stream_buf is NULL,
it will cause null-ptr-deref when using it to copy memory. So we
need check the return value of ksmbd_vfs_getcasexattr() by comparing
with 0.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Yang Yingliang [Sat, 29 May 2021 08:20:57 +0000 (16:20 +0800)]
cifsd: fix memleak in ksmbd_vfs_stream_read()
Before ksmbd_vfs_stream_read() return, memory allocate in
ksmbd_vfs_getcasexattr() need be freed.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Yang Yingliang [Sat, 29 May 2021 08:20:56 +0000 (16:20 +0800)]
cifsd: fix memleak in ksmbd_vfs_stream_write()
Before assigning wbuf to stream_buf, memory allocate in
ksmbd_vfs_getcasexattr() need be freed.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Hyunchul Lee [Sat, 29 May 2021 00:59:59 +0000 (09:59 +0900)]
cifsd: make alignment match open parenthesis
checkpatch.pl complains as the following:
Alignment should match open parenthesis.
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 [Sat, 29 May 2021 13:46:53 +0000 (22:46 +0900)]
cifsd: enclose macro variables in parenthesis
checkpatch.pl complains as the following:
CHECK: Macro argument 'fp' may be better as '(fp)' to avoid
precedence issues.
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 [Fri, 28 May 2021 22:59:40 +0000 (07:59 +0900)]
cifsd: fix Control flow issues in ksmbd_build_ntlmssp_challenge_blob()
Fix a defect reported by Coverity Scan.
*** CID 1504970: Control flow issues (NO_EFFECT)
/fs/cifsd/auth.c: 622 in ksmbd_build_ntlmssp_challenge_blob()
616 name = kmalloc(2 + UNICODE_LEN(len), GFP_KERNEL);
617 if (!name)
618 return -ENOMEM;
619
620 conv_len = smb_strtoUTF16((__le16 *)name,
ksmbd_netbios_name(), len,
621 sess->conn->local_nls);
>>> CID 1504970: Control flow issues (NO_EFFECT)
>>> This less-than-zero comparison of an unsigned value is never true.
622 if (conv_len < 0 || conv_len > len) {
623 kfree(name);
624 return -EINVAL;
625 }
626
627 uni_len = UNICODE_LEN(conv_len);
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>
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>