From a0b1b38477844a63a4240a9ea13bcc583af1844a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 20 Feb 2019 12:11:17 +0000 Subject: [PATCH] netfilter: nft_compat: use-after-free when deleting targets mainline inclusion from mainline-v5.0-rc7 commit 753c111f655e category: bugfix bugzilla: 9559 CVE: NA ------------------------------------------------- Fetch pointer to module before target object is released. Fixes: 29e3880109e3 ("netfilter: nf_tables: fix use-after-free when deleting compat expressions") Fixes: 0ca743a55991 ("netfilter: nf_tables: add compatibility layer for x_tables") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Zhiqiang Liu Reviewed-by: Mao Wenan Signed-off-by: Yang Yingliang --- net/netfilter/nft_compat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 5eb269428832..a354e9771697 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c @@ -300,6 +300,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) { struct xt_target *target = expr->ops->data; void *info = nft_expr_priv(expr); + struct module *me = target->me; struct xt_tgdtor_param par; par.net = ctx->net; @@ -310,7 +311,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) par.target->destroy(&par); if (nft_xt_put(container_of(expr->ops, struct nft_xt, ops))) - module_put(target->me); + module_put(me); } static int nft_extension_dump_info(struct sk_buff *skb, int attr, -- GitLab