Commit 239a87c8 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NET_SCHED]: act_ipt: fix regression in ipt action

The x_tables patch broke target module autoloading in the ipt action
by replacing the ipt_find_target call (which does autoloading) by
xt_find_target (which doesn't do autoloading). Additionally xt_find_target
may return ERR_PTR values in case of an error, which are not handled.

Use xt_request_find_target, which does both autoloading and ERR_PTR
handling properly. Also don't forget to drop the target module reference
again when xt_check_target fails.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e34efe3b
...@@ -55,7 +55,8 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int ...@@ -55,7 +55,8 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int
struct ipt_target *target; struct ipt_target *target;
int ret = 0; int ret = 0;
target = xt_find_target(AF_INET, t->u.user.name, t->u.user.revision); target = xt_request_find_target(AF_INET, t->u.user.name,
t->u.user.revision);
if (!target) if (!target)
return -ENOENT; return -ENOENT;
...@@ -63,9 +64,10 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int ...@@ -63,9 +64,10 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int
ret = xt_check_target(target, AF_INET, t->u.target_size - sizeof(*t), ret = xt_check_target(target, AF_INET, t->u.target_size - sizeof(*t),
table, hook, 0, 0); table, hook, 0, 0);
if (ret) if (ret) {
module_put(t->u.kernel.target->me);
return ret; return ret;
}
if (t->u.kernel.target->checkentry if (t->u.kernel.target->checkentry
&& !t->u.kernel.target->checkentry(table, NULL, && !t->u.kernel.target->checkentry(table, NULL,
t->u.kernel.target, t->data, t->u.kernel.target, t->data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment