Unverified Commit e6c3cef2 authored by 蒋家盛's avatar 蒋家盛 Committed by Konstantin Komarov
Browse files

fs/ntfs3: Add check for kmemdup



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: b46acd6a ("fs/ntfs3: Add NTFS journal")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent bfa434c6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -4256,6 +4256,10 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
	rec_len -= t32;

	attr_names = kmemdup(Add2Ptr(lrh, t32), rec_len, GFP_NOFS);
	if (!attr_names) {
		err = -ENOMEM;
		goto out;
	}

	lcb_put(lcb);
	lcb = NULL;