From 2526ddbdbe46196d25026a25ae9fcb1a3e67ee3f Mon Sep 17 00:00:00 2001 From: Rama Aparna Mallavarapu Date: Mon, 25 Mar 2019 11:46:23 -0700 Subject: [PATCH] devfreq: bw_mon: check for the return value of start_monitor The BWMON governor start is returning success on GOV_START event without checking for the return value of start_monitor. The return value of start_monitor is not being returned to ret variable. This would cause the governor to start successfully even when the monitor failed to start causing a NULL pointer derefence when accessing the device attributes. Fix it by checking the return value of start_monitor. Change-Id: I8c1f6933d44ae4533c6b81ccda8a5c4c0da3779c Signed-off-by: Rama Aparna Mallavarapu [avajid@codeaurora.org: minor change to check ret < 0] Signed-off-by: Amir Vajid --- drivers/devfreq/governor_bw_hwmon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/governor_bw_hwmon.c b/drivers/devfreq/governor_bw_hwmon.c index fe0071b3db4f..2a57dc847279 100644 --- a/drivers/devfreq/governor_bw_hwmon.c +++ b/drivers/devfreq/governor_bw_hwmon.c @@ -599,7 +599,8 @@ static int gov_start(struct devfreq *df) node->orig_data = df->data; df->data = node; - if (start_monitor(df, true)) + ret = start_monitor(df, true); + if (ret < 0) goto err_start; ret = sysfs_create_group(&df->dev.kobj, node->attr_grp);