summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Vasilyev <vasilyev@ispras.ru>2018-07-27 16:59:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-19 22:41:33 +0200
commit9d8c6300d1585e7f97f2b0e371659e5a5c0bc510 (patch)
tree9ae294d785d0f6dc587c70b2655d3437a548ff82
parent0d268eaecd3d352addefddacc3f1854257d6af5c (diff)
downloadlinux-stable-9d8c6300d1585e7f97f2b0e371659e5a5c0bc510.tar.gz
linux-stable-9d8c6300d1585e7f97f2b0e371659e5a5c0bc510.tar.bz2
linux-stable-9d8c6300d1585e7f97f2b0e371659e5a5c0bc510.zip
regulator: tps65217: Fix NULL pointer dereference on probe
[ Upstream commit 4f919ca2bf6da826ba1a4316e1b8e9c94e5dbeb2 ] There is no check that tps->strobes is allocated successfully in tps65217_regulator_probe(). The patch adds corresponding check. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/regulator/tps65217-regulator.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c
index fc12badf3805..d84fab616abf 100644
--- a/drivers/regulator/tps65217-regulator.c
+++ b/drivers/regulator/tps65217-regulator.c
@@ -232,6 +232,8 @@ static int tps65217_regulator_probe(struct platform_device *pdev)
tps->strobes = devm_kcalloc(&pdev->dev,
TPS65217_NUM_REGULATOR, sizeof(u8),
GFP_KERNEL);
+ if (!tps->strobes)
+ return -ENOMEM;
platform_set_drvdata(pdev, tps);