Commit 3c13725f authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso
Browse files

netfilter: nf_tables: bail out if stateful expression provides no .clone



All existing NFT_EXPR_STATEFUL provide a .clone interface, remove
fallback to copy content of stateful expression since this is never
exercised and bail out if .clone interface is not defined.

Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 65b3bd60
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -3274,14 +3274,13 @@ int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src)
{
	int err;

	if (src->ops->clone) {
	if (WARN_ON_ONCE(!src->ops->clone))
		return -EINVAL;

	dst->ops = src->ops;
	err = src->ops->clone(dst, src);
	if (err < 0)
		return err;
	} else {
		memcpy(dst, src, src->ops->size);
	}

	__module_get(src->ops->type->owner);