aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2015-05-10 23:29:27 +0530
committerAmit Pundir <amit.pundir@linaro.org>2015-05-10 23:29:27 +0530
commit7cf5e6fb3a5ad78072e2a6eea041667cadca8676 (patch)
tree9fcb0f1f42b3d41f54212c294219b8bd95c5961a /net
parent401b999aa32ba52f4f074bafc3220fc25fb99ef2 (diff)
parente6665aa9d5c6ff93921ce3ec3904dd15d690808d (diff)
downloadlinux-linaro-stable-7cf5e6fb3a5ad78072e2a6eea041667cadca8676.tar.gz
Merge branch 'android-3.14' of https://android.googlesource.com/kernel/common
* android-3.14: ipv4: Missing sk_nulls_node_init() in ping_unhash(). cpufreq: interactive: Round up timer_rate to match jiffy cpufreq: interactive: Don't set floor_validate_time during boost SELinux: ss: Fix policy write for ioctl operations nf: IDLETIMER: Adds the uid field in the msg android: configs: Enable SELinux and its dependencies. SELinux: use deletion-safe iterator to free list subsystem: CPU FREQUENCY DRIVERS- Set cpu_load calculation on current frequency
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ping.c1
-rw-r--r--net/netfilter/xt_IDLETIMER.c37
2 files changed, 33 insertions, 5 deletions
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index bdf2a257b142..0bb83e7ce8c7 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -158,6 +158,7 @@ void ping_unhash(struct sock *sk)
if (sk_hashed(sk)) {
write_lock_bh(&ping_table.lock);
hlist_nulls_del(&sk->sk_nulls_node);
+ sk_nulls_node_init(&sk->sk_nulls_node);
sock_put(sk);
isk->inet_num = 0;
isk->inet_sport = 0;
diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c
index f6562ba97a97..ddf77f7fbe24 100644
--- a/net/netfilter/xt_IDLETIMER.c
+++ b/net/netfilter/xt_IDLETIMER.c
@@ -48,6 +48,7 @@
#include <linux/suspend.h>
#include <linux/notifier.h>
#include <net/net_namespace.h>
+#include <net/sock.h>
struct idletimer_tg_attr {
struct attribute attr;
@@ -73,6 +74,7 @@ struct idletimer_tg {
bool work_pending;
bool send_nl_msg;
bool active;
+ uid_t uid;
};
static LIST_HEAD(idletimer_tg_list);
@@ -117,7 +119,8 @@ static void notify_netlink_uevent(const char *iface, struct idletimer_tg *timer)
char iface_msg[NLMSG_MAX_SIZE];
char state_msg[NLMSG_MAX_SIZE];
char timestamp_msg[NLMSG_MAX_SIZE];
- char *envp[] = { iface_msg, state_msg, timestamp_msg, NULL };
+ char uid_msg[NLMSG_MAX_SIZE];
+ char *envp[] = { iface_msg, state_msg, timestamp_msg, uid_msg, NULL };
int res;
struct timespec ts;
uint64_t time_ns;
@@ -140,6 +143,16 @@ static void notify_netlink_uevent(const char *iface, struct idletimer_tg *timer)
return;
}
+ if (state) {
+ res = snprintf(uid_msg, NLMSG_MAX_SIZE, "UID=%u", timer->uid);
+ if (NLMSG_MAX_SIZE <= res)
+ pr_err("message too long (%d)", res);
+ } else {
+ res = snprintf(uid_msg, NLMSG_MAX_SIZE, "UID=");
+ if (NLMSG_MAX_SIZE <= res)
+ pr_err("message too long (%d)", res);
+ }
+
time_ns = timespec_to_ns(&ts);
res = snprintf(timestamp_msg, NLMSG_MAX_SIZE, "TIME_NS=%llu", time_ns);
if (NLMSG_MAX_SIZE <= res) {
@@ -147,7 +160,8 @@ static void notify_netlink_uevent(const char *iface, struct idletimer_tg *timer)
pr_err("message too long (%d)", res);
}
- pr_debug("putting nlmsg: <%s> <%s>\n", iface_msg, state_msg);
+ pr_debug("putting nlmsg: <%s> <%s> <%s> <%s>\n", iface_msg, state_msg,
+ timestamp_msg, uid_msg);
kobject_uevent_env(idletimer_tg_kobj, KOBJ_CHANGE, envp);
return;
@@ -298,6 +312,7 @@ static int idletimer_tg_create(struct idletimer_tg_info *info)
info->timer->delayed_timer_trigger.tv_sec = 0;
info->timer->delayed_timer_trigger.tv_nsec = 0;
info->timer->work_pending = false;
+ info->timer->uid = 0;
get_monotonic_boottime(&info->timer->last_modified_timer);
info->timer->pm_nb.notifier_call = idletimer_resume;
@@ -321,7 +336,8 @@ out:
return ret;
}
-static void reset_timer(const struct idletimer_tg_info *info)
+static void reset_timer(const struct idletimer_tg_info *info,
+ struct sk_buff *skb)
{
unsigned long now = jiffies;
struct idletimer_tg *timer = info->timer;
@@ -334,6 +350,17 @@ static void reset_timer(const struct idletimer_tg_info *info)
if (!timer_prev || time_before(timer->timer.expires, now)) {
pr_debug("Starting Checkentry timer (Expired, Jiffies): %lu, %lu\n",
timer->timer.expires, now);
+
+ /* Stores the uid resposible for waking up the radio */
+ if (skb && (skb->sk)) {
+ struct sock *sk = skb->sk;
+ read_lock_bh(&sk->sk_callback_lock);
+ if ((sk->sk_socket) && (sk->sk_socket->file) &&
+ (sk->sk_socket->file->f_cred))
+ timer->uid = sk->sk_socket->file->f_cred->uid;
+ read_unlock_bh(&sk->sk_callback_lock);
+ }
+
/* checks if there is a pending inactive notification*/
if (timer->work_pending)
timer->delayed_timer_trigger = timer->last_modified_timer;
@@ -372,7 +399,7 @@ static unsigned int idletimer_tg_target(struct sk_buff *skb,
}
/* TODO: Avoid modifying timers on each packet */
- reset_timer(info);
+ reset_timer(info, skb);
return XT_CONTINUE;
}
@@ -400,7 +427,7 @@ static int idletimer_tg_checkentry(const struct xt_tgchk_param *par)
info->timer = __idletimer_tg_find_by_label(info->label);
if (info->timer) {
info->timer->refcnt++;
- reset_timer(info);
+ reset_timer(info, NULL);
pr_debug("increased refcnt of timer %s to %u\n",
info->label, info->timer->refcnt);
} else {