mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-18 16:44:33 +00:00
thunderbolt: Fix a missing check of kmemdup
kmemdup may fail and return NULL. The fix adds a check and returns NULL in case it fails to avoid NULL pointer dereferecen. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
106204b56f
commit
e4dfdd5804
1 changed files with 4 additions and 0 deletions
|
@ -176,6 +176,10 @@ static struct tb_property_dir *__tb_property_parse_dir(const u32 *block,
|
|||
} else {
|
||||
dir->uuid = kmemdup(&block[dir_offset], sizeof(*dir->uuid),
|
||||
GFP_KERNEL);
|
||||
if (!dir->uuid) {
|
||||
tb_property_free_dir(dir);
|
||||
return NULL;
|
||||
}
|
||||
content_offset = dir_offset + 4;
|
||||
content_len = dir_len - 4; /* Length includes UUID */
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue