From patchwork Mon Jun 1 17:54:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30A6AC433DF for ; Mon, 1 Jun 2020 18:44:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00317206E2 for ; Mon, 1 Jun 2020 18:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591037070; bh=Q+bRuituz91riDfVExULSdjxiY/t16izRsR7ZhFvuOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uKle4wgsV3/ZUF0FQcVHBG0moqGmMcjYCDVW/pQgotOm2RWUOxY4juKtPaM6k4yY4 bIsHoWR93AHXHcQ2BLXRhaqAjMCU7QNzPvI5R6VFUbyyIW7exMpkIir2dr0CbTrO4q KlzkB0/D9cWwG5XgPAV8kfiCglBa94/GajDug2kQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730073AbgFASoW (ORCPT ); Mon, 1 Jun 2020 14:44:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:57606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729710AbgFASKi (ORCPT ); Mon, 1 Jun 2020 14:10:38 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3272B2065C; Mon, 1 Jun 2020 18:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591035037; bh=Q+bRuituz91riDfVExULSdjxiY/t16izRsR7ZhFvuOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tWAM7jvpsb3W9f0eukyXgyIX3ZArZE81HW720tzRXvsXOBF7iLqd7EeUyf7+sD4nm tBTqgCnZyaVRGGrRlyeKtPDg3saMv3tbjbsn/EYRR47l7KEn80d8o6rBK7HD1fLgtr Jr83DK/2wn1NJfgkR8SsPxhCtXvz03pkCpyUI4xw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.4 124/142] netfilter: nfnetlink_cthelper: unbreak userspace helper support Date: Mon, 1 Jun 2020 19:54:42 +0200 Message-Id: <20200601174050.656545762@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pablo Neira Ayuso commit 703acd70f2496537457186211c2f03e792409e68 upstream. 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 Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nfnetlink_cthelper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/netfilter/nfnetlink_cthelper.c +++ b/net/netfilter/nfnetlink_cthelper.c @@ -103,7 +103,7 @@ nfnl_cthelper_from_nlattr(struct nlattr 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 ret = -ENOMEM; goto err2; } + helper->data_len = size; helper->flags |= NF_CT_HELPER_F_USERSPACE; memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));