Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2901753pxb; Tue, 24 Aug 2021 10:12:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1VTkpTheLvVMbgq8OmAvWoGf+UDdT0fkzHMZ2e8JQLDPtenrJ9UH+NfKmE/GAfspyOrrk X-Received: by 2002:a92:bf03:: with SMTP id z3mr26262883ilh.196.1629825146137; Tue, 24 Aug 2021 10:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825146; cv=none; d=google.com; s=arc-20160816; b=dPZmHD2jLn3OiGWKUq7T7mquB3A8K88jWR8eNVKETXxQXQbVywbO+Lq/LjD0cQgqh3 stZoxEuRpU0l9bAXDmXbS2k9PD2HMWVSvqo/0pDpGF5bO4Vjg/UzI1n03Aik0YPGo40J l+XSsOGchDPSs6z6tCrjcLlHEEjM69wBE1KLXtoZKJzbFZ/kmRvnvXyxgtDXj4XmeF9k 5qq8wdqgssZzHNSbY4B5GdlBqa2SY9gFnZxAPlQpTooqYcZKjXv0LeWe6Ldsy62TeBVW 19NuGej2/dX0RgbH0RpJUvjngFThFC7k5T1FxUmysidE5P5Mc+VpJIz+k+/t7C6jYqwL kcjg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c8RwmIgMutn23dw31ht1tWWDl48RKe/qz2VPVV+QklA=; b=HOxMN9UWJiD2RLeYbP2m/pUwSQ6qxVJMUE7LjSE+hC5FVf39KKfFIJccYg14cflZeZ iocUU+dE8BH+76x4Gs1Z8diPPsiZWc1dbTslfUAx9/QALV9ndINafXsO2YEalSgyYJOB DPyeLHu89rL9QjDifNXwqJ33FT/Oz7e2GQN4NVBz7SSoYRBeUF6SicIz9Va6TgDNmDhY GpZSk6Mn9GIJb5OtzOxSVAbMbWhxZd2Laei1tBQRtxbkUkavKzQyTJ8/G3aOtNoS5egJ DLPGqwG5ELrn+BaiXBxCwbLvIUbFD/YDQ9j8dOhZeoCkXIFmgB2vmtRkNPM9Wx4ZtPpJ 9IEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RYit3yMT; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k11si18749895ili.81.2021.08.24.10.12.14; Tue, 24 Aug 2021 10:12:26 -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=@kernel.org header.s=k20201202 header.b=RYit3yMT; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239802AbhHXRMN (ORCPT + 99 others); Tue, 24 Aug 2021 13:12:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:52370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239859AbhHXRJk (ORCPT ); Tue, 24 Aug 2021 13:09:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B80B61A52; Tue, 24 Aug 2021 17:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824422; bh=AESHKDUZqNd5dXqLnLIv1OlWBblWwGqbJADwnOLV8YE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RYit3yMTnYft5ORaBt6Br7AMNH8c1a+7aRUC/rhUWsNyC6qNFF1GrliNLi+PRSNri DD97egVpwyjJkZQ+CSPxnP+Jih6aLSD/U0cQ4dCBbFN88D0rC3JJh//AQsow1uEUuD +MEsbZ71Ik42EnEHP8Grnm19PgVr2Dtm7o1ScWshWT1nqmUcgx4TxgXjfz6nNCM+eG HskrJUviRE9EK2v7SqiHU1Zep1AVLIqnAjXJsbTkorhvw/t/EAMzrMo1+7LDCU5ys9 4DUNrVbbor5ahkvLOzN1Mtsn575FN/F8Snb6v4eTHaRwicLxRLtuH6LosvM572a05H ItnoFdth0NCZQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ido Schimmel , gushengxian , Jamal Hadi Salim , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 72/98] Revert "flow_offload: action should not be NULL when it is referenced" Date: Tue, 24 Aug 2021 12:58:42 -0400 Message-Id: <20210824165908.709932-73-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165908.709932-1-sashal@kernel.org> References: <20210824165908.709932-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.61-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.61-rc1 X-KernelTest-Deadline: 2021-08-26T16:58+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ido Schimmel [ Upstream commit fa05bdb89b01b098aad19ec0ebc4d1cc7b11177e ] This reverts commit 9ea3e52c5bc8bb4a084938dc1e3160643438927a. Cited commit added a check to make sure 'action' is not NULL, but 'action' is already dereferenced before the check, when calling flow_offload_has_one_action(). Therefore, the check does not make any sense and results in a smatch warning: include/net/flow_offload.h:322 flow_action_mixed_hw_stats_check() warn: variable dereferenced before check 'action' (see line 319) Fix by reverting this commit. Cc: gushengxian Fixes: 9ea3e52c5bc8 ("flow_offload: action should not be NULL when it is referenced") Signed-off-by: Ido Schimmel Acked-by: Jamal Hadi Salim Link: https://lore.kernel.org/r/20210819105842.1315705-1-idosch@idosch.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- include/net/flow_offload.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 161b90979038..123b1e9ea304 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -312,14 +312,12 @@ flow_action_mixed_hw_stats_check(const struct flow_action *action, if (flow_offload_has_one_action(action)) return true; - if (action) { - flow_action_for_each(i, action_entry, action) { - if (i && action_entry->hw_stats != last_hw_stats) { - NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported"); - return false; - } - last_hw_stats = action_entry->hw_stats; + flow_action_for_each(i, action_entry, action) { + if (i && action_entry->hw_stats != last_hw_stats) { + NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported"); + return false; } + last_hw_stats = action_entry->hw_stats; } return true; } -- 2.30.2