netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: x_tables: unlock on error in xt_find_table_lock()
@ 2017-04-28 12:57 Dan Carpenter
  2017-04-28 13:03 ` Florian Westphal
  2017-04-28 13:51 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-04-28 12:57 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal
  Cc: Jozsef Kadlecsik, David S. Miller, netfilter-devel, coreteam,
	kernel-janitors

According to my static checker we should unlock here before the return.
That seems reasonable to me as well.

Fixes" b9e69e127397 ("netfilter: xtables: don't hook tables by default")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index e58ecff638b3..8876b7da6884 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1041,8 +1041,10 @@ struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
 	list_for_each_entry(t, &init_net.xt.tables[af], list) {
 		if (strcmp(t->name, name))
 			continue;
-		if (!try_module_get(t->me))
+		if (!try_module_get(t->me)) {
+			mutex_unlock(&xt[af].mutex);
 			return NULL;
+		}
 
 		mutex_unlock(&xt[af].mutex);
 		if (t->table_init(net) != 0) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] netfilter: x_tables: unlock on error in xt_find_table_lock()
  2017-04-28 12:57 [PATCH] netfilter: x_tables: unlock on error in xt_find_table_lock() Dan Carpenter
@ 2017-04-28 13:03 ` Florian Westphal
  2017-04-28 13:51 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2017-04-28 13:03 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Pablo Neira Ayuso, Florian Westphal, Jozsef Kadlecsik,
	David S. Miller, netfilter-devel, coreteam, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> wrote:
> According to my static checker we should unlock here before the return.
> That seems reasonable to me as well.

Indeed, thanks for the fix!

Acked-by: Florian Westphal <fw@strlen.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] netfilter: x_tables: unlock on error in xt_find_table_lock()
  2017-04-28 12:57 [PATCH] netfilter: x_tables: unlock on error in xt_find_table_lock() Dan Carpenter
  2017-04-28 13:03 ` Florian Westphal
@ 2017-04-28 13:51 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2017-04-28 13:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Florian Westphal, Jozsef Kadlecsik, David S. Miller,
	netfilter-devel, coreteam, kernel-janitors

On Fri, Apr 28, 2017 at 03:57:56PM +0300, Dan Carpenter wrote:
> According to my static checker we should unlock here before the return.
> That seems reasonable to me as well.

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-28 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-28 12:57 [PATCH] netfilter: x_tables: unlock on error in xt_find_table_lock() Dan Carpenter
2017-04-28 13:03 ` Florian Westphal
2017-04-28 13:51 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).