summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2011-12-02 13:53:23 +0800
committerAndy Green <andy.green@linaro.org>2011-12-02 13:53:23 +0800
commitbaecc3c32fca6c36a21b03e7334d63e13b8e431a (patch)
treeddfe715a465a7d345a1619d0403681e6b04f9f94 /net
parent81fd040327780fe4248cd77a8f4f72f6d30afebb (diff)
netfilter: xt_qtaguid: warn only once for missing proc qtaguid data
When a process doesn't have /dev/xt_qtaguid open, only warn once instead of for every ctrl access. Change-Id: I98a462a8731254ddc3bf6d2fefeef9823659b1f0 Signed-off-by: JP Abgrall <jpa@google.com>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/xt_qtaguid.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/net/netfilter/xt_qtaguid.c b/net/netfilter/xt_qtaguid.c
index 6026c59b4ef..fba12eded18 100644
--- a/net/netfilter/xt_qtaguid.c
+++ b/net/netfilter/xt_qtaguid.c
@@ -1937,8 +1937,15 @@ static int ctrl_cmd_tag(const char *input)
spin_lock_bh(&uid_tag_data_tree_lock);
pqd_entry = proc_qtu_data_tree_search(
&proc_qtu_data_tree, current->tgid);
- /* TODO: remove if() test, do BUG_ON() */
- WARN_ON(IS_ERR_OR_NULL(pqd_entry));
+ /*
+ * TODO: remove if, and start failing.
+ * At first, we want to catch user-space code that is not
+ * opening the /dev/xt_qtaguid.
+ */
+ WARN_ONCE(IS_ERR_OR_NULL(pqd_entry),
+ "qtaguid: User space forgot to open /dev/xt_qtaguid? "
+ "pid=%u tgid=%u uid=%u\n",
+ current->pid, current->tgid, current_fsuid());
if (!IS_ERR_OR_NULL(pqd_entry)) {
list_add(&sock_tag_entry->list,
&pqd_entry->sock_tag_list);
@@ -2017,8 +2024,15 @@ static int ctrl_cmd_untag(const char *input)
spin_lock_bh(&uid_tag_data_tree_lock);
pqd_entry = proc_qtu_data_tree_search(
&proc_qtu_data_tree, current->tgid);
- /* TODO: remove if() test, do BUG_ON() */
- WARN_ON(IS_ERR_OR_NULL(pqd_entry));
+ /*
+ * TODO: remove if, and start failing.
+ * At first, we want to catch user-space code that is not
+ * opening the /dev/xt_qtaguid.
+ */
+ WARN_ONCE(IS_ERR_OR_NULL(pqd_entry),
+ "qtaguid: User space forgot to open /dev/xt_qtaguid? "
+ "pid=%u tgid=%u uid=%u\n",
+ current->pid, current->tgid, current_fsuid());
if (!IS_ERR_OR_NULL(pqd_entry))
list_del(&sock_tag_entry->list);
spin_unlock_bh(&uid_tag_data_tree_lock);