]> Pileus Git - ~andy/linux/blobdiff - net/netfilter/x_tables.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke...
[~andy/linux] / net / netfilter / x_tables.c
index 0a77d2ff21543937ba00d6ee09230c9124f7ed5b..a9adf4c6b299ee35a72c4617e0d3e565031de940 100644 (file)
@@ -183,14 +183,14 @@ EXPORT_SYMBOL(xt_unregister_matches);
 /*
  * These are weird, but module loading must not be done with mutex
  * held (since they will register), and we have to have a single
- * function to use try_then_request_module().
+ * function to use.
  */
 
 /* Find match, grabs ref.  Returns ERR_PTR() on error. */
 struct xt_match *xt_find_match(u8 af, const char *name, u8 revision)
 {
        struct xt_match *m;
-       int err = 0;
+       int err = -ENOENT;
 
        if (mutex_lock_interruptible(&xt[af].mutex) != 0)
                return ERR_PTR(-EINTR);
@@ -221,9 +221,13 @@ xt_request_find_match(uint8_t nfproto, const char *name, uint8_t revision)
 {
        struct xt_match *match;
 
-       match = try_then_request_module(xt_find_match(nfproto, name, revision),
-                                       "%st_%s", xt_prefix[nfproto], name);
-       return (match != NULL) ? match : ERR_PTR(-ENOENT);
+       match = xt_find_match(nfproto, name, revision);
+       if (IS_ERR(match)) {
+               request_module("%st_%s", xt_prefix[nfproto], name);
+               match = xt_find_match(nfproto, name, revision);
+       }
+
+       return match;
 }
 EXPORT_SYMBOL_GPL(xt_request_find_match);
 
@@ -231,7 +235,7 @@ EXPORT_SYMBOL_GPL(xt_request_find_match);
 struct xt_target *xt_find_target(u8 af, const char *name, u8 revision)
 {
        struct xt_target *t;
-       int err = 0;
+       int err = -ENOENT;
 
        if (mutex_lock_interruptible(&xt[af].mutex) != 0)
                return ERR_PTR(-EINTR);
@@ -261,9 +265,13 @@ struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision)
 {
        struct xt_target *target;
 
-       target = try_then_request_module(xt_find_target(af, name, revision),
-                                        "%st_%s", xt_prefix[af], name);
-       return (target != NULL) ? target : ERR_PTR(-ENOENT);
+       target = xt_find_target(af, name, revision);
+       if (IS_ERR(target)) {
+               request_module("%st_%s", xt_prefix[af], name);
+               target = xt_find_target(af, name, revision);
+       }
+
+       return target;
 }
 EXPORT_SYMBOL_GPL(xt_request_find_target);