Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4325174pxj; Tue, 8 Jun 2021 11:32:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1DzGR6anwufxAAY0009GDJf8DxGi6HmSz40yS90TtxOvyRHRPACb7rEH4ZjrqERcrqWIx X-Received: by 2002:a17:906:a245:: with SMTP id bi5mr25736788ejb.316.1623177141566; Tue, 08 Jun 2021 11:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623177141; cv=none; d=google.com; s=arc-20160816; b=XZC/ezUaDoDf6BIJAFfO9bsuDGlIXP5Kgs14gIPE1fYjgX7L6sCYF3bmvkRvHp53V0 LDE4safJ3oGOY0Jlw/a19NusnJMKkSwEAJXF5eOwPhk2PmcW12KUYuYVzwXQT6hug1YT jP842swWNiWOZztohRHVjyLw0NS73EJG3dGshNNQ5rw2LhsxYtkQwmp3fXVhPQu8+jYV 49xkwcIGhBx3curKJdqdujk4RJacUs6JfvENG/5VWwYV+Qx5+08Pl3YrG8KPDbvKVBL+ QkX+3bYraJgaRLFfLCQQ0ul9yM6lGtmrlMEmCSjP4AEmSZ8zrwEXuNhfSggI7SGwPrGH eKJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x940Ph9qoUsfmC1yeM/XMlHXjIcn+u7tuoK/rFyMZmw=; b=EZejF+cMKzkrT3xsveheN9f31RypPVRipY011ZvcOkysqEJpNdBMM7vkW2DkYrNnxJ 2REwq7CVeVCi7iQUNO82ndEbB+62WJgMCNMBsGbbaNSQWxkH3zWjf2SnaIX7byiiYHMo xl8bLvXbrdDedl95aAlHmM3eWnG61NZOvFUdyMSIRwkOx1eJD279j9sPf8xzdCIU6wm1 T2ads8gnxSJ9N0iuEovBcFmiEwNYzPDM56qmtgpU5Na6y87p8qfhwiYjqBZ097BqDhAU Yi8KtjZDuWPIa5+XibTeyGtdbcXqzRuLjVHECEIK4ISW5+TWxBIhZEwkTHqdhJtoytnh EHWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=efZ41uaV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi15si409809edb.459.2021.06.08.11.31.58; Tue, 08 Jun 2021 11:32:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=efZ41uaV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234148AbhFHSbd (ORCPT + 99 others); Tue, 8 Jun 2021 14:31:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:55748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234153AbhFHSbO (ORCPT ); Tue, 8 Jun 2021 14:31:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 049C9613B9; Tue, 8 Jun 2021 18:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623176945; bh=OkZwXrHpxEFAEoYWsY/fBqlUlzOVkf3DGeAuhfwiJ0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=efZ41uaVB9PnsUZ6J+RtrHfAodXYmTe/FzHuhTf/3a/O+0hCUTyO8gKSsKeNasLpg FoaipKNCNb9vRTXOwX5iB97etSjTJF1Bu/vJ8zN++5y59Z8RDieD6wzd4moZ2M5FMq pYp1S+fU6wFYvzOagmsXKUjBZRYk3NrSLUTHcndY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 4.4 06/23] netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches Date: Tue, 8 Jun 2021 20:26:58 +0200 Message-Id: <20210608175926.752384937@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175926.524658689@linuxfoundation.org> References: <20210608175926.524658689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pablo Neira Ayuso [ Upstream commit 8971ee8b087750a23f3cd4dc55bff2d0303fd267 ] The private helper data size cannot be updated. However, updates that contain NFCTH_PRIV_DATA_LEN might bogusly hit EBUSY even if the size is the same. Fixes: 12f7a505331e ("netfilter: add user-space connection tracking helper infrastructure") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nfnetlink_cthelper.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c index 8c1733869343..63a9d5fd00c0 100644 --- a/net/netfilter/nfnetlink_cthelper.c +++ b/net/netfilter/nfnetlink_cthelper.c @@ -355,10 +355,14 @@ static int nfnl_cthelper_update(const struct nlattr * const tb[], struct nf_conntrack_helper *helper) { + u32 size; int ret; - if (tb[NFCTH_PRIV_DATA_LEN]) - return -EBUSY; + if (tb[NFCTH_PRIV_DATA_LEN]) { + size = ntohl(nla_get_be32(tb[NFCTH_PRIV_DATA_LEN])); + if (size != helper->data_len) + return -EBUSY; + } if (tb[NFCTH_POLICY]) { ret = nfnl_cthelper_update_policy(helper, tb[NFCTH_POLICY]); -- 2.30.2