All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org
Subject: [PATCH 5/5] netfilter: nfnetlink_cthelper: unbreak userspace helper support
Date: Mon, 25 May 2020 23:54:20 +0200	[thread overview]
Message-ID: <20200525215420.2290-6-pablo@netfilter.org> (raw)
In-Reply-To: <20200525215420.2290-1-pablo@netfilter.org>

Restore helper data size initialization and fix memcopy of the helper
data size.

Fixes: 157ffffeb5dc ("netfilter: nfnetlink_cthelper: reject too large userspace allocation requests")
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nfnetlink_cthelper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
index a5f294aa8e4c..5b0d0a77379c 100644
--- a/net/netfilter/nfnetlink_cthelper.c
+++ b/net/netfilter/nfnetlink_cthelper.c
@@ -103,7 +103,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct)
 	if (help->helper->data_len == 0)
 		return -EINVAL;
 
-	nla_memcpy(help->data, nla_data(attr), sizeof(help->data));
+	nla_memcpy(help->data, attr, sizeof(help->data));
 	return 0;
 }
 
@@ -240,6 +240,7 @@ nfnl_cthelper_create(const struct nlattr * const tb[],
 		ret = -ENOMEM;
 		goto err2;
 	}
+	helper->data_len = size;
 
 	helper->flags |= NF_CT_HELPER_F_USERSPACE;
 	memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));
-- 
2.20.1


  parent reply	other threads:[~2020-05-25 21:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 21:54 [PATCH 0/5] Netfilter fixes for net Pablo Neira Ayuso
2020-05-25 21:54 ` [PATCH 1/5] netfilter: nft_reject_bridge: enable reject with bridge vlan Pablo Neira Ayuso
2020-05-25 21:54 ` [PATCH 2/5] netfilter: ipset: Fix subcounter update skip Pablo Neira Ayuso
2020-05-25 21:54 ` [PATCH 3/5] netfilter: nf_conntrack_pptp: prevent buffer overflows in debug code Pablo Neira Ayuso
2020-05-27 11:55   ` kbuild test robot
2020-05-25 21:54 ` [PATCH 4/5] netfilter: conntrack: make conntrack userspace helpers work again Pablo Neira Ayuso
2020-05-26 18:45   ` Jakub Kicinski
2020-05-27 14:51   ` kbuild test robot
2020-05-25 21:54 ` Pablo Neira Ayuso [this message]
2020-05-26  1:29 ` [PATCH 0/5] Netfilter fixes for net David Miller
2020-05-26 20:10   ` Pablo Neira Ayuso
2020-05-26 23:08     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200525215420.2290-6-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.