From 6cb6fbf1f834d05f58ad1fb3030151105f3f5fed Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 13 Feb 2023 01:33:47 -0500 Subject: [PATCH] Fixes for 4.14 Signed-off-by: Sasha Levin --- ...-fix-confusing-types-in-return-value.patch | 38 +++++++++++++++++ ...ingle-fix-potential-null-dereference.patch | 41 +++++++++++++++++++ queue-4.14/series | 2 + 3 files changed, 81 insertions(+) create mode 100644 queue-4.14/pinctrl-aspeed-fix-confusing-types-in-return-value.patch create mode 100644 queue-4.14/pinctrl-single-fix-potential-null-dereference.patch diff --git a/queue-4.14/pinctrl-aspeed-fix-confusing-types-in-return-value.patch b/queue-4.14/pinctrl-aspeed-fix-confusing-types-in-return-value.patch new file mode 100644 index 00000000000..d7161ef946a --- /dev/null +++ b/queue-4.14/pinctrl-aspeed-fix-confusing-types-in-return-value.patch @@ -0,0 +1,38 @@ +From 8f3e0d096ac8eeba6592c9ba26f061eb95b7067a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Jan 2023 09:48:56 +1030 +Subject: pinctrl: aspeed: Fix confusing types in return value + +From: Joel Stanley + +[ Upstream commit 287a344a11f1ebd31055cf9b22c88d7005f108d7 ] + +The function signature is int, but we return a bool. Instead return a +negative errno as the kerneldoc suggests. + +Fixes: 4d3d0e4272d8 ("pinctrl: Add core support for Aspeed SoCs") +Signed-off-by: Joel Stanley +Reviewed-by: Andrew Jeffery +Link: https://lore.kernel.org/r/20230119231856.52014-1-joel@jms.id.au +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/aspeed/pinctrl-aspeed.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c +index 5249033ed413e..b7155377a86d6 100644 +--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c ++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c +@@ -295,7 +295,7 @@ static int aspeed_disable_sig(const struct aspeed_sig_expr **exprs, + int ret = 0; + + if (!exprs) +- return true; ++ return -EINVAL; + + while (*exprs && !ret) { + ret = aspeed_sig_expr_disable(*exprs, maps); +-- +2.39.0 + diff --git a/queue-4.14/pinctrl-single-fix-potential-null-dereference.patch b/queue-4.14/pinctrl-single-fix-potential-null-dereference.patch new file mode 100644 index 00000000000..eeaa18e7ea6 --- /dev/null +++ b/queue-4.14/pinctrl-single-fix-potential-null-dereference.patch @@ -0,0 +1,41 @@ +From 469adc152e7d2a6c7ff4fbc5accf1acb4739b5e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Nov 2022 13:43:32 +0300 +Subject: pinctrl: single: fix potential NULL dereference + +From: Maxim Korotkov + +[ Upstream commit d2d73e6d4822140445ad4a7b1c6091e0f5fe703b ] + +Added checking of pointer "function" in pcs_set_mux(). +pinmux_generic_get_function() can return NULL and the pointer +"function" was dereferenced without checking against NULL. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: 571aec4df5b7 ("pinctrl: single: Use generic pinmux helpers for managing functions") +Signed-off-by: Maxim Korotkov +Reviewed-by: Tony Lindgren +Link: https://lore.kernel.org/r/20221118104332.943-1-korotkov.maxim.s@gmail.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/pinctrl-single.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c +index d633737a3bf95..44936fca576ed 100644 +--- a/drivers/pinctrl/pinctrl-single.c ++++ b/drivers/pinctrl/pinctrl-single.c +@@ -339,6 +339,8 @@ static int pcs_set_mux(struct pinctrl_dev *pctldev, unsigned fselector, + if (!pcs->fmask) + return 0; + function = pinmux_generic_get_function(pctldev, fselector); ++ if (!function) ++ return -EINVAL; + func = function->data; + if (!func) + return -EINVAL; +-- +2.39.0 + diff --git a/queue-4.14/series b/queue-4.14/series index bb25c4e168b..c82edafa393 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -26,3 +26,5 @@ serial-8250_dma-fix-dma-rx-rearm-race.patch btrfs-limit-device-extents-to-the-device-size.patch alsa-emux-avoid-potential-array-out-of-bound-in-snd_emux_xg_control.patch alsa-pci-lx6464es-fix-a-debug-loop.patch +pinctrl-aspeed-fix-confusing-types-in-return-value.patch +pinctrl-single-fix-potential-null-dereference.patch -- 2.47.2