projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
106204b
)
thunderbolt: Fix a missing check of kmemdup
author
Kangjie Lu
<kjlu@umn.edu>
Thu, 14 Mar 2019 06:55:31 +0000
(
01:55
-0500)
committer
Mika Westerberg
<mika.westerberg@linux.intel.com>
Wed, 20 Mar 2019 10:37:12 +0000
(13:37 +0300)
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>
drivers/thunderbolt/property.c
patch
|
blob
|
history
diff --git
a/drivers/thunderbolt/property.c
b/drivers/thunderbolt/property.c
index ee76449524a3c784b2ca468448eb9e89df91176f..841314deb446dbe2c39cdf72342d5f273254db23 100644
(file)
--- a/
drivers/thunderbolt/property.c
+++ b/
drivers/thunderbolt/property.c
@@
-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 */
}