mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 23:27:06 +00:00
fs/ntfs3: Add check for kmemdup
[ Upstream commite6c3cef24c
] Since the kmemdup may return NULL pointer, it should be better to add check for the return value in order to avoid NULL pointer dereference. Fixes:b46acd6a6a
("fs/ntfs3: Add NTFS journal") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
93bf79f989
commit
9f36704a58
1 changed files with 4 additions and 0 deletions
|
@ -4256,6 +4256,10 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
|
||||||
rec_len -= t32;
|
rec_len -= t32;
|
||||||
|
|
||||||
attr_names = kmemdup(Add2Ptr(lrh, t32), rec_len, GFP_NOFS);
|
attr_names = kmemdup(Add2Ptr(lrh, t32), rec_len, GFP_NOFS);
|
||||||
|
if (!attr_names) {
|
||||||
|
err = -ENOMEM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
lcb_put(lcb);
|
lcb_put(lcb);
|
||||||
lcb = NULL;
|
lcb = NULL;
|
||||||
|
|
Loading…
Reference in a new issue