Revert "netfilter: nf_tables: allow clone callbacks to sleep"

This reverts commit b2a587e7a5.
This commit is contained in:
Ksawlii 2024-11-24 00:23:54 +01:00
parent ebf3750840
commit c44e98a853
5 changed files with 10 additions and 10 deletions

View file

@ -786,7 +786,7 @@ struct nft_expr_ops {
struct nft_regs *regs, struct nft_regs *regs,
const struct nft_pktinfo *pkt); const struct nft_pktinfo *pkt);
int (*clone)(struct nft_expr *dst, int (*clone)(struct nft_expr *dst,
const struct nft_expr *src, gfp_t gfp); const struct nft_expr *src);
unsigned int size; unsigned int size;
int (*init)(const struct nft_ctx *ctx, int (*init)(const struct nft_ctx *ctx,
@ -837,7 +837,7 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)
return (void *)expr->data; return (void *)expr->data;
} }
int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src, gfp_t gfp); int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src);
void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr); void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr);
int nft_expr_dump(struct sk_buff *skb, unsigned int attr, int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
const struct nft_expr *expr); const struct nft_expr *expr);

View file

@ -2968,13 +2968,13 @@ err_expr_parse:
return ERR_PTR(err); return ERR_PTR(err);
} }
int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src, gfp_t gfp) int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src)
{ {
int err; int err;
if (src->ops->clone) { if (src->ops->clone) {
dst->ops = src->ops; dst->ops = src->ops;
err = src->ops->clone(dst, src, gfp); err = src->ops->clone(dst, src);
if (err < 0) if (err < 0)
return err; return err;
} else { } else {
@ -5524,7 +5524,7 @@ static int nft_set_elem_expr_setup(struct nft_ctx *ctx,
if (expr == NULL) if (expr == NULL)
return 0; return 0;
err = nft_expr_clone(elem_expr, expr, GFP_KERNEL); err = nft_expr_clone(elem_expr, expr);
if (err < 0) if (err < 0)
return -ENOMEM; return -ENOMEM;
@ -5632,7 +5632,7 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
if (!expr) if (!expr)
return -ENOMEM; return -ENOMEM;
err = nft_expr_clone(expr, set->expr, GFP_KERNEL); err = nft_expr_clone(expr, set->expr);
if (err < 0) if (err < 0)
goto err_set_elem_expr; goto err_set_elem_expr;
} }

View file

@ -195,7 +195,7 @@ static void nft_connlimit_destroy(const struct nft_ctx *ctx,
nft_connlimit_do_destroy(ctx, priv); nft_connlimit_do_destroy(ctx, priv);
} }
static int nft_connlimit_clone(struct nft_expr *dst, const struct nft_expr *src, gfp_t gfp) static int nft_connlimit_clone(struct nft_expr *dst, const struct nft_expr *src)
{ {
struct nft_connlimit *priv_dst = nft_expr_priv(dst); struct nft_connlimit *priv_dst = nft_expr_priv(dst);
struct nft_connlimit *priv_src = nft_expr_priv(src); struct nft_connlimit *priv_src = nft_expr_priv(src);

View file

@ -224,7 +224,7 @@ static void nft_counter_destroy(const struct nft_ctx *ctx,
nft_counter_do_destroy(priv); nft_counter_do_destroy(priv);
} }
static int nft_counter_clone(struct nft_expr *dst, const struct nft_expr *src, gfp_t gfp) static int nft_counter_clone(struct nft_expr *dst, const struct nft_expr *src)
{ {
struct nft_counter_percpu_priv *priv = nft_expr_priv(src); struct nft_counter_percpu_priv *priv = nft_expr_priv(src);
struct nft_counter_percpu_priv *priv_clone = nft_expr_priv(dst); struct nft_counter_percpu_priv *priv_clone = nft_expr_priv(dst);
@ -234,7 +234,7 @@ static int nft_counter_clone(struct nft_expr *dst, const struct nft_expr *src, g
nft_counter_fetch(priv, &total); nft_counter_fetch(priv, &total);
cpu_stats = alloc_percpu_gfp(struct nft_counter, gfp); cpu_stats = alloc_percpu_gfp(struct nft_counter, GFP_ATOMIC);
if (cpu_stats == NULL) if (cpu_stats == NULL)
return -ENOMEM; return -ENOMEM;

View file

@ -48,7 +48,7 @@ static void *nft_dynset_new(struct nft_set *set, const struct nft_expr *expr,
ext = nft_set_elem_ext(set, elem); ext = nft_set_elem_ext(set, elem);
if (priv->expr != NULL && if (priv->expr != NULL &&
nft_expr_clone(nft_set_ext_expr(ext), priv->expr, GFP_ATOMIC) < 0) nft_expr_clone(nft_set_ext_expr(ext), priv->expr) < 0)
goto err2; goto err2;
return elem; return elem;