From a1ea9a400f5c76cdbe31a8f5c3154f464d84b803 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Tue, 23 May 2017 20:41:40 +0200 Subject: [PATCH] pinctrl: samsung: Handle memory allocation failure during wakeup banks init Check if kmemdup failed during wakeup banks initialization. Otherwise NULL pointer would be stored under "irq_chip" member of bank and later dereferenced in interrupt handler. Signed-off-by: Krzysztof Kozlowski --- drivers/pinctrl/samsung/pinctrl-exynos.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 727462cc670c..96068b40d32a 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -479,6 +479,8 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) if (match) { irq_chip = kmemdup(match->data, sizeof(*irq_chip), GFP_KERNEL); + if (!irq_chip) + return -ENOMEM; wkup_np = np; break; } -- 2.20.1