OSDN Git Service

gpio: syscon: Fix possible NULL ptr usage
authorMarek Vasut <marex@denx.de>
Wed, 3 Oct 2018 22:52:52 +0000 (00:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Nov 2019 14:54:50 +0000 (15:54 +0100)
commit6d49b0992d02f620a5356a6420dc4ce82a2705e5
treecb33b30243b7ca7be1bced9d71e37a73d63f93b3
parentdf3de9e92c3b0f268b0479c452b4710cf39380ff
gpio: syscon: Fix possible NULL ptr usage

[ Upstream commit 70728c29465bc4bfa7a8c14304771eab77e923c7 ]

The priv->data->set can be NULL while flags contains GPIO_SYSCON_FEAT_OUT
and chip->set is valid pointer. This happens in case the controller uses
the default GPIO setter. Always use chip->set to access the setter to avoid
possible NULL pointer dereferencing.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-syscon.c