lkml.org 
[lkml]   [2018]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] Preventive patch in the pin control subsystem to handle NULL check.
Date
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
\
 
 \ /
  Last update: 2018-08-27 10:39    [W:0.038 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site