Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4326176pxj; Tue, 8 Jun 2021 11:34:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMSgdEOgobVkjaynIRVJe2mnD2U9WyQfclRTC4l5N+RoNA79f9sTqqa3APcYQ4Kp+/z4jr X-Received: by 2002:a17:907:7848:: with SMTP id lb8mr25458347ejc.494.1623177240547; Tue, 08 Jun 2021 11:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623177240; cv=none; d=google.com; s=arc-20160816; b=pumXw/D8SUpjPbUg0PYtP2ejVlnn134nDJgTLsG8K1vhJaKSQ7VBH9af6zj/AA0Olp Q1tmzz8WO96cYn+ffy11Yt3rZy8ffF33eENADsPluPFZzHuCRzp57uPDH+gpgFgcLhHM i0fCG2oJI9rY/QVbHp8Vyq6/G1AvZiYESB5J1upCjumj07dS8ztRlTOE1Ou3RtkLF4TS 6QVyi3T4FTZPTG3mVl+6wE1U329nlnuvh9YZ0PjYDbji2V5GjeYw0Us5gRwVnYjBscKW ozUkZYHerba1tch0G5ZCEJJ8khbvgGG98Xe+KpnhDfkXw9V/R9visd/Udu+hM12DOSZP l/sw== 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=kOBP5TS42Qdi/0O5HArIy4XDAQOfkQUZ4xZ2AE29Cv8=; b=ZLmRNgAp4jf7LOem/dqJndCY+Cul1kHmBHlJuEn/+JYKKXjBFWWEeDh53UBLQZN+GF +cF2DybLZUM6VTlsoZ8Kr0mJ97evQuj0y68gJMvGEGjTvma1EigRt2F4sn+2TFxTcDT/ qu9T6o2dXCifMciLhu5sceVqLQhyn897gtiWkoewkUD3qeQUcIJ+UveS5aLxEPJzLHBz uUV6bTGeXEiEnk0yaHfmFA/C0pP3+axIqsQ1dlq5ipsnIPBRKwsJYvPmWcjvl16au6iw ben2AY3G50r6VKdoNzRb4/X8RZbZP0uCVrghNlVBKc2rtgsh54vwjRdApdGheAzO1A54 7vTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i7IxpWxF; 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 y3si348980edp.547.2021.06.08.11.33.36; Tue, 08 Jun 2021 11:34:00 -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=i7IxpWxF; 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 S234331AbhFHScz (ORCPT + 99 others); Tue, 8 Jun 2021 14:32:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:56768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233653AbhFHScA (ORCPT ); Tue, 8 Jun 2021 14:32:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B342B613AC; Tue, 8 Jun 2021 18:29:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623176991; bh=wtStW2NSvFCE9dbD5KI9A/NpOyQmvPopXx6VPXcXqUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i7IxpWxFs6NyRtENQRD5674jE9I6oNzHSNJ7RyHenvrCk9dMON3nOag2Ofle50srp bkZWsOpEMnXPPkwDocAYUapRuxw2UzGWJAejhiefagzbZ+nqeYKED9MhiCHysxQDdO 82BebJ7lkBPOrKk1u8XcU7tGID45LqQcpBfvDlcU= 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.9 10/29] netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches Date: Tue, 8 Jun 2021 20:27:04 +0200 Message-Id: <20210608175928.152758687@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175927.821075974@linuxfoundation.org> References: <20210608175927.821075974@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 8396dc8ee247..babe42ff3eec 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