linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Preventive patch in the pin control subsystem to handle NULL check.
       [not found] <CGME20180827083916epcas1p43a3fc8570269411de215254ce0ae4b37@epcas1p4.samsung.com>
@ 2018-08-27  8:38 ` Srikanth K H
       [not found]   ` <CGME20180827083916epcas1p43a3fc8570269411de215254ce0ae4b37@epcms5p2>
  2018-08-30  9:03   ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Srikanth K H @ 2018-08-27  8:38 UTC (permalink / raw)
  To: linus.walleij, linux-gpio, linux-kernel; +Cc: srikanth.h

If the pin descriptor requested for the physical pin fails then the
descriptor is dereferenced without checking for its validity which
may lead to crash, hence added preventive code to check for NULL
and accordingly dereference.

Signed-off-by: Srikanth K H <srikanth.h@samsung.com>
---
 drivers/pinctrl/pinconf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index d3fe143..576d08d 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -269,8 +269,9 @@ void pinconf_show_setting(struct seq_file *s,
 	case PIN_MAP_TYPE_CONFIGS_PIN:
 		desc = pin_desc_get(setting->pctldev,
 				    setting->data.configs.group_or_pin);
-		seq_printf(s, "pin %s (%d)", desc->name,
-			   setting->data.configs.group_or_pin);
+		if (desc)
+			seq_printf(s, "pin %s (%d)", desc->name,
+				   setting->data.configs.group_or_pin);
 		break;
 	case PIN_MAP_TYPE_CONFIGS_GROUP:
 		seq_printf(s, "group %s (%d)",
-- 
1.9.1


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

* RE: [PATCH 1/1] Preventive patch in the pin control subsystem to handle NULL check.
       [not found]   ` <CGME20180827083916epcas1p43a3fc8570269411de215254ce0ae4b37@epcms5p2>
@ 2018-08-29 10:25     ` Srikanth Korangala Hari
  0 siblings, 0 replies; 3+ messages in thread
From: Srikanth Korangala Hari @ 2018-08-29 10:25 UTC (permalink / raw)
  To: linus.walleij, linux-gpio, linux-kernel; +Cc: Srikanth Korangala Hari

> If the pin descriptor requested for the physical pin fails then the
> descriptor is dereferenced without checking for its validity which
> may lead to crash, hence added preventive code to check for NULL
> and accordingly dereference.
 
> Signed-off-by: Srikanth K H <srikanth.h@samsung.com>
> ---
> drivers/pinctrl/pinconf.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
 
> diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
> index d3fe143..576d08d 100644
> --- a/drivers/pinctrl/pinconf.c
> +++ b/drivers/pinctrl/pinconf.c
> @@ -269,8 +269,9 @@ void pinconf_show_setting(struct seq_file *s,
>         case PIN_MAP_TYPE_CONFIGS_PIN:
>                 desc = pin_desc_get(setting->pctldev,
>                                     setting->data.configs.group_or_pin);
> -                seq_printf(s, "pin %s (%d)", desc->name,
> -                           setting->data.configs.group_or_pin);
> +                if (desc)
> +                        seq_printf(s, "pin %s (%d)", desc->name,
> +                                   setting->data.configs.group_or_pin);
>                 break;
>         case PIN_MAP_TYPE_CONFIGS_GROUP:
>                 seq_printf(s, "group %s (%d)",

Dear Maintainer's,

Please confirm me whether the above patch is considered for merging onto mainline ?

Thanks,
Srikanth
 
 

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

* Re: [PATCH 1/1] Preventive patch in the pin control subsystem to handle NULL check.
  2018-08-27  8:38 ` [PATCH 1/1] Preventive patch in the pin control subsystem to handle NULL check Srikanth K H
       [not found]   ` <CGME20180827083916epcas1p43a3fc8570269411de215254ce0ae4b37@epcms5p2>
@ 2018-08-30  9:03   ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-08-30  9:03 UTC (permalink / raw)
  To: srikanth.h; +Cc: open list:GPIO SUBSYSTEM, linux-kernel

Hi Srikanth, thanks for your patch!

On Mon, Aug 27, 2018 at 10:39 AM Srikanth K H <srikanth.h@samsung.com> wrote:

 @@ -269,8 +269,9 @@ void pinconf_show_setting(struct seq_file *s,

>                 desc = pin_desc_get(setting->pctldev,
>                                     setting->data.configs.group_or_pin);
> -               seq_printf(s, "pin %s (%d)", desc->name,
> -                          setting->data.configs.group_or_pin);
> +               if (desc)
> +                       seq_printf(s, "pin %s (%d)", desc->name,
> +                                  setting->data.configs.group_or_pin);

Under what circumstances do you expect this to happen?
Did you provoke it with a real usecase during development?

We do not sprinkle NULL or error handling over code that
will not derail, and since this is in debugfs we are even more
lax.

If it annoys users (which would then be developers using
debugfs during development), then we need to look into it.

Yours,
Linus Walleij

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

end of thread, other threads:[~2018-08-30  9:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180827083916epcas1p43a3fc8570269411de215254ce0ae4b37@epcas1p4.samsung.com>
2018-08-27  8:38 ` [PATCH 1/1] Preventive patch in the pin control subsystem to handle NULL check Srikanth K H
     [not found]   ` <CGME20180827083916epcas1p43a3fc8570269411de215254ce0ae4b37@epcms5p2>
2018-08-29 10:25     ` Srikanth Korangala Hari
2018-08-30  9:03   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).