]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: sunxi: Prevent against null dereference for vmmc
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Wed, 19 Oct 2016 13:33:04 +0000 (15:33 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 29 Nov 2016 08:00:31 +0000 (09:00 +0100)
commit15e70e75540f3b09d1c45d869eaebf785980c6d2
treea096aa5f2b22b7b1d37ebc4b829fb8d4c4103528
parent65f0a4be00e4a1a4552df7f4608dbd4b15ba4ba6
mmc: sunxi: Prevent against null dereference for vmmc

VMMC is an optional regulator, which means that mmc_regulator_get_supply
will only return an error in case of a deferred probe, but not when the
regulator is not set in the DT.

However, the sunxi driver assumes that VMMC is always there, and doesn't
check the value of the regulator pointer before using it, which obviously
leads to a (close to) null pointer dereference.

Add proper checks to prevent that.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sunxi-mmc.c