提交 a905b82e 编写于 作者: P Pablo Neira Ayuso 提交者: Greg Kroah-Hartman

netfilter: nft_compat: use-after-free when deleting targets

commit 753c111f655e38bbd52fc01321266633f022ebe2 upstream.

Fetch pointer to module before target object is released.

Fixes: 29e3880109e3 ("netfilter: nf_tables: fix use-after-free when deleting compat expressions")
Fixes: 0ca743a5 ("netfilter: nf_tables: add compatibility layer for x_tables")
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 1500d94e
...@@ -282,6 +282,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) ...@@ -282,6 +282,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr)
{ {
struct xt_target *target = expr->ops->data; struct xt_target *target = expr->ops->data;
void *info = nft_expr_priv(expr); void *info = nft_expr_priv(expr);
struct module *me = target->me;
struct xt_tgdtor_param par; struct xt_tgdtor_param par;
par.net = ctx->net; par.net = ctx->net;
...@@ -292,7 +293,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) ...@@ -292,7 +293,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr)
par.target->destroy(&par); par.target->destroy(&par);
if (nft_xt_put(container_of(expr->ops, struct nft_xt, ops))) if (nft_xt_put(container_of(expr->ops, struct nft_xt, ops)))
module_put(target->me); module_put(me);
} }
static int nft_target_dump(struct sk_buff *skb, const struct nft_expr *expr) static int nft_target_dump(struct sk_buff *skb, const struct nft_expr *expr)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册