This is a note to let you know that I've just added the patch titled
PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock
to the 3.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
pm-sleep-require-cap_block_suspend-to-use-wake_lock-wake_unlock.patch
and it can be found in the queue-3.5 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 11388c87d2abca1f01975ced28ce9eacea239104 Mon Sep 17 00:00:00 2001
From: "Rafael J. Wysocki" <[email protected]>
Date: Thu, 19 Jul 2012 00:00:58 +0200
Subject: PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock
From: "Rafael J. Wysocki" <[email protected]>
commit 11388c87d2abca1f01975ced28ce9eacea239104 upstream.
Require processes wanting to use the wake_lock/wake_unlock sysfs
files to have the CAP_BLOCK_SUSPEND capability, which also is
required for the eventpoll EPOLLWAKEUP flag to be effective, so that
all interfaces related to blocking autosleep depend on the same
capability.
Signed-off-by: Rafael J. Wysocki <[email protected]>
Acked-by: Michael Kerrisk <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/power/wakelock.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -9,6 +9,7 @@
* manipulate wakelocks on Android.
*/
+#include <linux/capability.h>
#include <linux/ctype.h>
#include <linux/device.h>
#include <linux/err.h>
@@ -188,6 +189,9 @@ int pm_wake_lock(const char *buf)
size_t len;
int ret = 0;
+ if (!capable(CAP_BLOCK_SUSPEND))
+ return -EPERM;
+
while (*str && !isspace(*str))
str++;
@@ -231,6 +235,9 @@ int pm_wake_unlock(const char *buf)
size_t len;
int ret = 0;
+ if (!capable(CAP_BLOCK_SUSPEND))
+ return -EPERM;
+
len = strlen(buf);
if (!len)
return -EINVAL;
Patches currently in stable-queue which might be from [email protected] are
queue-3.5/pm-sleep-require-cap_block_suspend-to-use-wake_lock-wake_unlock.patch
queue-3.5/pm-sleep-call-early-resume-handlers-when-suspend_noirq-fails.patch
queue-3.5/ftrace-disable-function-tracing-during-suspend-resume-and-hibernation-again.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html