[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CADPKJ-5EXJnihARj49cr36Q16ApU_qQeEA0eS=kx21s1oAR=wQ@mail.gmail.com>
Date: Thu, 3 Oct 2024 09:52:16 +0800
From: xi xi <clf700383@...il.com>
To: Drew Fustini <drew@...7.com>, Guo Ren <guoren@...nel.org>, Fu Wei <wefu@...hat.com>,
Linus Walleij <linus.walleij@...aro.org>
Cc: linux-riscv@...ts.infradead.org, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] pinctrl: fix Null pointer dereference
>From b673ea2897c5efc60b4ad8f9b4a4327ddce0737e Mon Sep 17 00:00:00 2001
From: clingfei <clf700383@...il.com>
Date: Wed, 2 Oct 2024 23:33:47 +0800
Subject: [PATCH] pinctrl: fix Null pointer dereference
pinmux_generic_get_function may returns NULL, and its retval is
dereferenced without check, which will cause a null pointer dereference.
Signed-off-by: clingfei <clf700383@...il.com>
---
drivers/pinctrl/pinctrl-th1520.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c
index 1bb78b212fd5..9331f4462480 100644
--- a/drivers/pinctrl/pinctrl-th1520.c
+++ b/drivers/pinctrl/pinctrl-th1520.c
@@ -798,6 +798,8 @@ static int th1520_pinmux_set_mux(struct
pinctrl_dev *pctldev,
struct th1520_pinctrl *thp = pinctrl_dev_get_drvdata(pctldev);
const struct function_desc *func =
pinmux_generic_get_function(pctldev, fsel);
+ if (!func)
+ return -EINVAL;
return th1520_pinmux_set(thp, thp->desc.pins[gsel].number,
(uintptr_t)thp->desc.pins[gsel].drv_data & TH1520_PAD_MUXDATA,
(uintptr_t)func->data);
--
2.34.1
Powered by blists - more mailing lists