[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1406234495.3363.79.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 24 Jul 2014 22:41:35 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Patrick McHardy <kaber@...sh.net>
Cc: Pablo Neira Ayuso <pablo@...filter.org>,
David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>, netfilter-devel@...r.kernel.org
Subject: [PATCH v2] netfilter: nf_sockopt_find() / nf_register_sockopt()
should not return EINTR
From: Eric Dumazet <edumazet@...gle.com>
getsockopt() or setsockopt() sometimes returns -EINTR instead of
-ENOPROTOOPT, causing headaches to application developers.
This is because unsupported commands might go through nf_sockopt_find()
and this function returns -EINTR if a signal is pending.
Just use non interruptible mutex functions, as there is no reason
we should sleep for a long time here.
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
v2: at Patrick suggestion simply use mutex_lock()
net/netfilter/nf_sockopt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c
index f042ae521557..3e59a465407b 100644
--- a/net/netfilter/nf_sockopt.c
+++ b/net/netfilter/nf_sockopt.c
@@ -26,8 +26,7 @@ int nf_register_sockopt(struct nf_sockopt_ops *reg)
struct nf_sockopt_ops *ops;
int ret = 0;
- if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0)
- return -EINTR;
+ mutex_lock(&nf_sockopt_mutex);
list_for_each_entry(ops, &nf_sockopts, list) {
if (ops->pf == reg->pf
@@ -65,8 +64,7 @@ static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, u_int8_t pf,
{
struct nf_sockopt_ops *ops;
- if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0)
- return ERR_PTR(-EINTR);
+ mutex_lock(&nf_sockopt_mutex);
list_for_each_entry(ops, &nf_sockopts, list) {
if (ops->pf == pf) {
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists