diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-07 16:23:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-07 16:23:13 -0400 |
commit | 448bfad8a185876ce8de484a921d49769972cad7 (patch) | |
tree | 2dd2648f31b2bf7c127734baae70df82ae5b1d0d /tools | |
parent | 4c2f503aade27ebf12f5733a583d711f99dc5ec1 (diff) | |
parent | 4adccf9fc84aaf5e4d18442e163d549e0b603075 (diff) |
Merge branch 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal fixes from Zhang Rui:
"Specifics:
- update Email address of Thermal subsystem maintainer Eduardo
Valentin.
- fix a problem that unloading thermal module results in kernel crash
because a non-exist device file is removed on thermal unload.
- fix a problem that critical trip point is set wrongly on latest
i.MX6 SOC and results in system critical shutdown.
- a couple of fixes to Tmon tool, of-thermal code and ti thermal
driver"
* 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
tmon: set umask to a reasonable value
tmon: Check log file for common secuirty issues
tools/thermal: tmon: fix compilation errors when building statically
thermal: ti-soc-thermal: ti-bandgap.c: Cleaning up wrong address is checked
Thermal: imx: correct critical trip temperature setting
thermal: Bind cooling devices with the correct arguments
thermal: Add braces around suspect code
thermal: hwmon: Make the check for critical temp valid consistent
MAINTAINERS: Update Eduardo Valentin's email address
Diffstat (limited to 'tools')
-rw-r--r-- | tools/thermal/tmon/Makefile | 2 | ||||
-rw-r--r-- | tools/thermal/tmon/tmon.c | 26 |
2 files changed, 26 insertions, 2 deletions
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile index 447321104ec0..e775adcbd29f 100644 --- a/tools/thermal/tmon/Makefile +++ b/tools/thermal/tmon/Makefile | |||
@@ -21,7 +21,7 @@ OBJS = tmon.o tui.o sysfs.o pid.o | |||
21 | OBJS += | 21 | OBJS += |
22 | 22 | ||
23 | tmon: $(OBJS) Makefile tmon.h | 23 | tmon: $(OBJS) Makefile tmon.h |
24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -lpthread | 24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -ltinfo -lpthread |
25 | 25 | ||
26 | valgrind: tmon | 26 | valgrind: tmon |
27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null | 27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null |
diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c index b30f531173e4..09b7c3218334 100644 --- a/tools/thermal/tmon/tmon.c +++ b/tools/thermal/tmon/tmon.c | |||
@@ -142,6 +142,7 @@ static void start_syslog(void) | |||
142 | static void prepare_logging(void) | 142 | static void prepare_logging(void) |
143 | { | 143 | { |
144 | int i; | 144 | int i; |
145 | struct stat logstat; | ||
145 | 146 | ||
146 | if (!logging) | 147 | if (!logging) |
147 | return; | 148 | return; |
@@ -152,6 +153,29 @@ static void prepare_logging(void) | |||
152 | return; | 153 | return; |
153 | } | 154 | } |
154 | 155 | ||
156 | if (lstat(TMON_LOG_FILE, &logstat) < 0) { | ||
157 | syslog(LOG_ERR, "Unable to stat log file %s\n", TMON_LOG_FILE); | ||
158 | fclose(tmon_log); | ||
159 | tmon_log = NULL; | ||
160 | return; | ||
161 | } | ||
162 | |||
163 | /* The log file must be a regular file owned by us */ | ||
164 | if (S_ISLNK(logstat.st_mode)) { | ||
165 | syslog(LOG_ERR, "Log file is a symlink. Will not log\n"); | ||
166 | fclose(tmon_log); | ||
167 | tmon_log = NULL; | ||
168 | return; | ||
169 | } | ||
170 | |||
171 | if (logstat.st_uid != getuid()) { | ||
172 | syslog(LOG_ERR, "We don't own the log file. Not logging\n"); | ||
173 | fclose(tmon_log); | ||
174 | tmon_log = NULL; | ||
175 | return; | ||
176 | } | ||
177 | |||
178 | |||
155 | fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); | 179 | fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); |
156 | for (i = 0; i < ptdata.nr_tz_sensor; i++) { | 180 | for (i = 0; i < ptdata.nr_tz_sensor; i++) { |
157 | char binding_str[33]; /* size of long + 1 */ | 181 | char binding_str[33]; /* size of long + 1 */ |
@@ -331,7 +355,7 @@ static void start_daemon_mode() | |||
331 | disable_tui(); | 355 | disable_tui(); |
332 | 356 | ||
333 | /* change the file mode mask */ | 357 | /* change the file mode mask */ |
334 | umask(0); | 358 | umask(S_IWGRP | S_IWOTH); |
335 | 359 | ||
336 | /* new SID for the daemon process */ | 360 | /* new SID for the daemon process */ |
337 | sid = setsid(); | 361 | sid = setsid(); |