mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-23 10:12:24 +00:00
ksmbd: use __GFP_RETRY_MAYFAIL
Prefer to report ENOMEM rather than incur the oom for allocations in ksmbd. __GFP_NORETRY could not achieve that, It would fail the allocations just too easily. __GFP_RETRY_MAYFAIL will keep retrying the allocation until there is no more progress and fail the allocation instead go OOM and let the caller to deal with it. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
committed by
Steve French
parent
d6eb09fb46
commit
0066f623bc
@@ -297,7 +297,7 @@ char *smb_strndup_from_utf16(const char *src, const int maxlen,
|
||||
if (is_unicode) {
|
||||
len = smb_utf16_bytes((__le16 *)src, maxlen, codepage);
|
||||
len += nls_nullsize(codepage);
|
||||
dst = kmalloc(len, GFP_KERNEL);
|
||||
dst = kmalloc(len, KSMBD_DEFAULT_GFP);
|
||||
if (!dst)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
ret = smb_from_utf16(dst, (__le16 *)src, len, maxlen, codepage,
|
||||
@@ -309,7 +309,7 @@ char *smb_strndup_from_utf16(const char *src, const int maxlen,
|
||||
} else {
|
||||
len = strnlen(src, maxlen);
|
||||
len++;
|
||||
dst = kmalloc(len, GFP_KERNEL);
|
||||
dst = kmalloc(len, KSMBD_DEFAULT_GFP);
|
||||
if (!dst)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
strscpy(dst, src, len);
|
||||
|
||||
Reference in New Issue
Block a user