* [PATCH] regmap: fix NULL pointer dereference in __regmap_init if bus is NULL
@ 2015-08-31 17:17 Sylvain Rochet
2015-08-31 17:29 ` Sylvain Rochet
0 siblings, 1 reply; 2+ messages in thread
From: Sylvain Rochet @ 2015-08-31 17:17 UTC (permalink / raw)
To: Mark Brown, Markus Pargmann, Kuninori Morimoto,
Srinivas Kandagatla, Xiubo Li, Nicolas Boichat, Pankaj Dubey,
linux-kernel, Stephen Rothwell
Cc: Sylvain Rochet
This fix adds a check for bus pointer before using bus struct members.
Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
drivers/base/regmap/regmap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
It was introduced by https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=5e5a40ab02e497fd234a54c3fb6eb05286636e7a
but I failed to find the commit which is not the merge commit.
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 650d3b1..7797cfd 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -574,8 +574,10 @@ struct regmap *__regmap_init(struct device *dev,
map->use_single_read = config->use_single_rw || !bus || !bus->read;
map->use_single_write = config->use_single_rw || !bus || !bus->write;
map->can_multi_write = config->can_multi_write && bus && bus->write;
- map->max_raw_read = bus->max_raw_read;
- map->max_raw_write = bus->max_raw_write;
+ if (bus) {
+ map->max_raw_read = bus->max_raw_read;
+ map->max_raw_write = bus->max_raw_write;
+ }
map->dev = dev;
map->bus = bus;
map->bus_context = bus_context;
--
2.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] regmap: fix NULL pointer dereference in __regmap_init if bus is NULL
2015-08-31 17:17 [PATCH] regmap: fix NULL pointer dereference in __regmap_init if bus is NULL Sylvain Rochet
@ 2015-08-31 17:29 ` Sylvain Rochet
0 siblings, 0 replies; 2+ messages in thread
From: Sylvain Rochet @ 2015-08-31 17:29 UTC (permalink / raw)
To: Mark Brown, Markus Pargmann, Kuninori Morimoto,
Srinivas Kandagatla, Xiubo Li, Nicolas Boichat, Pankaj Dubey,
linux-kernel, Stephen Rothwell
Hello,
On Mon, Aug 31, 2015 at 07:17:09PM +0200, Sylvain Rochet wrote:
> This fix adds a check for bus pointer before using bus struct members.
I just found out I'm a little too late, Sergey sent the exact same patch
a few hours ago, dammit :-)
Sylvain
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-31 17:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-31 17:17 [PATCH] regmap: fix NULL pointer dereference in __regmap_init if bus is NULL Sylvain Rochet
2015-08-31 17:29 ` Sylvain Rochet
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.