diff options
author | 2024-10-25 17:46:50 +0800 | |
---|---|---|
committer | 2024-12-08 21:59:39 +0900 | |
commit | 91329cb0a8cb4a7c7bb5743a65a052c084225d86 (patch) | |
tree | b680599e7c8d1f0a84981cfe33a62fd9c2e17dea | |
parent | Linux 6.13-rc1 (diff) | |
download | wireguard-linux-91329cb0a8cb4a7c7bb5743a65a052c084225d86.tar.xz wireguard-linux-91329cb0a8cb4a7c7bb5743a65a052c084225d86.zip |
extcon: realtek: fix NULL deref check in extcon_rtk_type_c_probe
In extcon_rtk_type_c_probe() devm_kzalloc() may return NULL but this
returned value is not checked.
Fixes: 8a590d7371f0 ("extcon: add Realtek DHC RTD SoC Type-C driver")
Link: https://lore.kernel.org/lkml/20241025094650.253599-1-hanchunchao@inspur.com/
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/extcon/extcon-rtk-type-c.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/extcon/extcon-rtk-type-c.c b/drivers/extcon/extcon-rtk-type-c.c index 19a01e663733..2820c7e82481 100644 --- a/drivers/extcon/extcon-rtk-type-c.c +++ b/drivers/extcon/extcon-rtk-type-c.c @@ -1369,6 +1369,8 @@ static int extcon_rtk_type_c_probe(struct platform_device *pdev) } type_c->type_c_cfg = devm_kzalloc(dev, sizeof(*type_c_cfg), GFP_KERNEL); + if (!type_c->type_c_cfg) + return -ENOMEM; memcpy(type_c->type_c_cfg, type_c_cfg, sizeof(*type_c_cfg)); |