All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] pinctrl: stm32: fix optional IRQ support to gpios" failed to apply to 5.18-stable tree
@ 2022-07-11  7:08 gregkh
  2022-07-11 15:44 ` Fabien DESSENNE
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2022-07-11  7:08 UTC (permalink / raw)
  To: fabien.dessenne, linus.walleij; +Cc: stable


The patch below does not apply to the 5.18-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From a1d4ef1adf8bbd302067534ead671a94759687ed Mon Sep 17 00:00:00 2001
From: Fabien Dessenne <fabien.dessenne@foss.st.com>
Date: Mon, 27 Jun 2022 16:23:50 +0200
Subject: [PATCH] pinctrl: stm32: fix optional IRQ support to gpios

To act as an interrupt controller, a gpio bank relies on the
"interrupt-parent" of the pin controller.
When this optional "interrupt-parent" misses, do not create any IRQ domain.

This fixes a "NULL pointer in stm32_gpio_domain_alloc()" kernel crash when
the interrupt-parent = <exti> property is not declared in the Device Tree.

Fixes: 0eb9f683336d ("pinctrl: Add IRQ support to STM32 gpios")
Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Link: https://lore.kernel.org/r/20220627142350.742973-1-fabien.dessenne@foss.st.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 57a33fb0f2d7..14bcca73238a 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -1338,16 +1338,18 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
 	bank->secure_control = pctl->match_data->secure_control;
 	spin_lock_init(&bank->lock);
 
-	/* create irq hierarchical domain */
-	bank->fwnode = fwnode;
+	if (pctl->domain) {
+		/* create irq hierarchical domain */
+		bank->fwnode = fwnode;
 
-	bank->domain = irq_domain_create_hierarchy(pctl->domain, 0,
-					STM32_GPIO_IRQ_LINE, bank->fwnode,
-					&stm32_gpio_domain_ops, bank);
+		bank->domain = irq_domain_create_hierarchy(pctl->domain, 0, STM32_GPIO_IRQ_LINE,
+							   bank->fwnode, &stm32_gpio_domain_ops,
+							   bank);
 
-	if (!bank->domain) {
-		err = -ENODEV;
-		goto err_clk;
+		if (!bank->domain) {
+			err = -ENODEV;
+			goto err_clk;
+		}
 	}
 
 	err = gpiochip_add_data(&bank->gpio_chip, bank);
@@ -1510,6 +1512,8 @@ int stm32_pctl_probe(struct platform_device *pdev)
 	pctl->domain = stm32_pctrl_get_irq_domain(pdev);
 	if (IS_ERR(pctl->domain))
 		return PTR_ERR(pctl->domain);
+	if (!pctl->domain)
+		dev_warn(dev, "pinctrl without interrupt support\n");
 
 	/* hwspinlock is optional */
 	hwlock_id = of_hwspin_lock_get_id(pdev->dev.of_node, 0);


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] pinctrl: stm32: fix optional IRQ support to gpios" failed to apply to 5.18-stable tree
  2022-07-11  7:08 FAILED: patch "[PATCH] pinctrl: stm32: fix optional IRQ support to gpios" failed to apply to 5.18-stable tree gregkh
@ 2022-07-11 15:44 ` Fabien DESSENNE
  2022-07-23 13:40   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Fabien DESSENNE @ 2022-07-11 15:44 UTC (permalink / raw)
  To: gregkh, linus.walleij; +Cc: stable

On 11/07/2022 09:08, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 5.18-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
> 
> thanks,
> 
> greg k-h
> 
> ------------------ original commit in Linus's tree ------------------
> 
>  From a1d4ef1adf8bbd302067534ead671a94759687ed Mon Sep 17 00:00:00 2001
> From: Fabien Dessenne <fabien.dessenne@foss.st.com>
> Date: Mon, 27 Jun 2022 16:23:50 +0200
> Subject: [PATCH] pinctrl: stm32: fix optional IRQ support to gpios
> 
> To act as an interrupt controller, a gpio bank relies on the
> "interrupt-parent" of the pin controller.
> When this optional "interrupt-parent" misses, do not create any IRQ domain.
> 
> This fixes a "NULL pointer in stm32_gpio_domain_alloc()" kernel crash when
> the interrupt-parent = <exti> property is not declared in the Device Tree.
> 
> Fixes: 0eb9f683336d ("pinctrl: Add IRQ support to STM32 gpios")
> Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
> Link: https://lore.kernel.org/r/20220627142350.742973-1-fabien.dessenne@foss.st.com
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> 
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index 57a33fb0f2d7..14bcca73238a 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -1338,16 +1338,18 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
>   	bank->secure_control = pctl->match_data->secure_control;
>   	spin_lock_init(&bank->lock);
>   
> -	/* create irq hierarchical domain */
> -	bank->fwnode = fwnode;
> +	if (pctl->domain) {
> +		/* create irq hierarchical domain */
> +		bank->fwnode = fwnode;
>   
> -	bank->domain = irq_domain_create_hierarchy(pctl->domain, 0,
> -					STM32_GPIO_IRQ_LINE, bank->fwnode,
> -					&stm32_gpio_domain_ops, bank);
> +		bank->domain = irq_domain_create_hierarchy(pctl->domain, 0, STM32_GPIO_IRQ_LINE,
> +							   bank->fwnode, &stm32_gpio_domain_ops,
> +							   bank);
>   
> -	if (!bank->domain) {
> -		err = -ENODEV;
> -		goto err_clk;
> +		if (!bank->domain) {
> +			err = -ENODEV;
> +			goto err_clk;
> +		}
>   	}
>   
>   	err = gpiochip_add_data(&bank->gpio_chip, bank);
> @@ -1510,6 +1512,8 @@ int stm32_pctl_probe(struct platform_device *pdev)
>   	pctl->domain = stm32_pctrl_get_irq_domain(pdev);
>   	if (IS_ERR(pctl->domain))
>   		return PTR_ERR(pctl->domain);
> +	if (!pctl->domain)
> +		dev_warn(dev, "pinctrl without interrupt support\n");
>   
>   	/* hwspinlock is optional */
>   	hwlock_id = of_hwspin_lock_get_id(pdev->dev.of_node, 0);
> 

Hi,

Below is an updated patch which fixes the problem on all 5.x releases 
(5.18, 5.15, 5.10, 5.4).
The initial patch can be dropped on any 4.x releases.

BR,
Fabien




 From d82f7a72e3b1c7b6ed86c17b2108db6f97b61dc7 Mon Sep 17 00:00:00 2001
From: Fabien Dessenne <fabien.dessenne@foss.st.com>
Date: Mon, 27 Jun 2022 14:55:35 +0200
Subject: [PATCH] pinctrl: stm32: fix optional IRQ support to gpios

To act as an interrupt controller, a gpio bank relies on the
"interrupt-parent" of the pin controller.
When this optional "interrupt-parent" misses, do not create any IRQ domain.

This fixes a "NULL pointer in stm32_gpio_domain_alloc()" kernel crash when
the interrupt-parent = <exti> property is not declared in the Device Tree.

Fixes: 0eb9f683336d ("pinctrl: Add IRQ support to STM32 gpios")

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
---
  drivers/pinctrl/stm32/pinctrl-stm32.c | 18 +++++++++++-------
  1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c 
b/drivers/pinctrl/stm32/pinctrl-stm32.c
index f7c9459f6628..edd0d0af5c14 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -1299,15 +1299,17 @@ static int stm32_gpiolib_register_bank(struct 
stm32_pinctrl *pctl,
  	bank->bank_ioport_nr = bank_ioport_nr;
  	spin_lock_init(&bank->lock);

-	/* create irq hierarchical domain */
-	bank->fwnode = of_node_to_fwnode(np);
+	if (pctl->domain) {
+		/* create irq hierarchical domain */
+		bank->fwnode = of_node_to_fwnode(np);

-	bank->domain = irq_domain_create_hierarchy(pctl->domain, 0,
-					STM32_GPIO_IRQ_LINE, bank->fwnode,
-					&stm32_gpio_domain_ops, bank);
+		bank->domain = irq_domain_create_hierarchy(pctl->domain, 0, 
STM32_GPIO_IRQ_LINE,
+							   bank->fwnode, &stm32_gpio_domain_ops,
+							   bank);

-	if (!bank->domain)
-		return -ENODEV;
+		if (!bank->domain)
+			return -ENODEV;
+	}

  	err = gpiochip_add_data(&bank->gpio_chip, bank);
  	if (err) {
@@ -1466,6 +1468,8 @@ int stm32_pctl_probe(struct platform_device *pdev)
  	pctl->domain = stm32_pctrl_get_irq_domain(np);
  	if (IS_ERR(pctl->domain))
  		return PTR_ERR(pctl->domain);
+	if (!pctl->domain)
+		dev_warn(dev, "pinctrl without interrupt support\n");

  	/* hwspinlock is optional */
  	hwlock_id = of_hwspin_lock_get_id(pdev->dev.of_node, 0);
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] pinctrl: stm32: fix optional IRQ support to gpios" failed to apply to 5.18-stable tree
  2022-07-11 15:44 ` Fabien DESSENNE
@ 2022-07-23 13:40   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-07-23 13:40 UTC (permalink / raw)
  To: Fabien DESSENNE; +Cc: linus.walleij, stable

On Mon, Jul 11, 2022 at 05:44:29PM +0200, Fabien DESSENNE wrote:
> On 11/07/2022 09:08, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 5.18-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> > ------------------ original commit in Linus's tree ------------------
> > 
> >  From a1d4ef1adf8bbd302067534ead671a94759687ed Mon Sep 17 00:00:00 2001
> > From: Fabien Dessenne <fabien.dessenne@foss.st.com>
> > Date: Mon, 27 Jun 2022 16:23:50 +0200
> > Subject: [PATCH] pinctrl: stm32: fix optional IRQ support to gpios
> > 
> > To act as an interrupt controller, a gpio bank relies on the
> > "interrupt-parent" of the pin controller.
> > When this optional "interrupt-parent" misses, do not create any IRQ domain.
> > 
> > This fixes a "NULL pointer in stm32_gpio_domain_alloc()" kernel crash when
> > the interrupt-parent = <exti> property is not declared in the Device Tree.
> > 
> > Fixes: 0eb9f683336d ("pinctrl: Add IRQ support to STM32 gpios")
> > Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
> > Link: https://lore.kernel.org/r/20220627142350.742973-1-fabien.dessenne@foss.st.com
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > 
> > diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> > index 57a33fb0f2d7..14bcca73238a 100644
> > --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> > +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> > @@ -1338,16 +1338,18 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
> >   	bank->secure_control = pctl->match_data->secure_control;
> >   	spin_lock_init(&bank->lock);
> > -	/* create irq hierarchical domain */
> > -	bank->fwnode = fwnode;
> > +	if (pctl->domain) {
> > +		/* create irq hierarchical domain */
> > +		bank->fwnode = fwnode;
> > -	bank->domain = irq_domain_create_hierarchy(pctl->domain, 0,
> > -					STM32_GPIO_IRQ_LINE, bank->fwnode,
> > -					&stm32_gpio_domain_ops, bank);
> > +		bank->domain = irq_domain_create_hierarchy(pctl->domain, 0, STM32_GPIO_IRQ_LINE,
> > +							   bank->fwnode, &stm32_gpio_domain_ops,
> > +							   bank);
> > -	if (!bank->domain) {
> > -		err = -ENODEV;
> > -		goto err_clk;
> > +		if (!bank->domain) {
> > +			err = -ENODEV;
> > +			goto err_clk;
> > +		}
> >   	}
> >   	err = gpiochip_add_data(&bank->gpio_chip, bank);
> > @@ -1510,6 +1512,8 @@ int stm32_pctl_probe(struct platform_device *pdev)
> >   	pctl->domain = stm32_pctrl_get_irq_domain(pdev);
> >   	if (IS_ERR(pctl->domain))
> >   		return PTR_ERR(pctl->domain);
> > +	if (!pctl->domain)
> > +		dev_warn(dev, "pinctrl without interrupt support\n");
> >   	/* hwspinlock is optional */
> >   	hwlock_id = of_hwspin_lock_get_id(pdev->dev.of_node, 0);
> > 
> 
> Hi,
> 
> Below is an updated patch which fixes the problem on all 5.x releases (5.18,
> 5.15, 5.10, 5.4).
> The initial patch can be dropped on any 4.x releases.

Thanks, now queued up.  Note, this was white-spaced damaged, I had to
fix it up by hand, you should fix your email client.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-23 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11  7:08 FAILED: patch "[PATCH] pinctrl: stm32: fix optional IRQ support to gpios" failed to apply to 5.18-stable tree gregkh
2022-07-11 15:44 ` Fabien DESSENNE
2022-07-23 13:40   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.