Commit Graph

11 Commits

Author SHA1 Message Date
Namjae Jeon c30f4eb84b 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>
2021-06-22 16:11:05 +09:00
Namjae Jeon fc2d1b58c4 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>
2021-05-26 18:13:59 +09:00
Namjae Jeon 070fb21e59 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>
2021-05-26 18:13:51 +09:00
Namjae Jeon d40012a83f 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>
2021-05-10 19:15:39 -05:00
Namjae Jeon 64b39f4a2f 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>
2021-05-10 19:15:29 -05:00
Namjae Jeon e506649907 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>
2021-05-10 19:15:27 -05:00
Dan Carpenter 849f59e1a1 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>
2021-05-10 19:15:26 -05:00
Hyunchul Lee 95fa1ce947 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>
2021-05-10 19:15:23 -05:00
Sergey Senozhatsky 2e2b0dda18 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>
2021-05-10 19:15:23 -05:00
Namjae Jeon e3f7087328 cifsd: fix WARNING: unmet direct dependencies detected for CRYPTO_ARC4
Randy reported warning message from fs/cifsd/Kconfig.

WARNING: unmet direct dependencies detected for CRYPTO_ARC4
  Depends on [n]: CRYPTO [=y] && CRYPTO_USER_API_ENABLE_OBSOLETE [=n]
  Selected by [y]:
  - SMB_SERVER [=y] && NETWORK_FILESYSTEMS [=y] && INET [=y]

arc4 library is not currently in use. So this patch eliminates
unnecessary library set in cifsd.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-10 19:15:19 -05:00
Namjae Jeon 0626e6641f cifsd: add server handler for central processing and tranport layers
This adds server handler for central processing,
transport layers(tcp, rdma, ipc) and a document describing cifsd
architecture.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-10 19:15:15 -05:00