From patchwork Fri Sep 25 12:48:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 309261 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=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 1AC02C4727D for ; Fri, 25 Sep 2020 12:49:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D986721D91 for ; Fri, 25 Sep 2020 12:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038156; bh=vfeYz1uzPXeSvrxX0hjIcfVWC4IOVSdlaZSE1O6JE1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ib8fM7/QX3Z5Up1NzikHE+PQ+0xkn3wUMeux4gOMWCTUFmwYKNEt9jzBpQ6DioBmP iMbZCcPnPRHKSkUbt9aErpoiWxRYa9NLQJy1SiqXHZ0Zc7Pi3ftKrHaRUQrzhYIyI4 OVcOjGSx4Z3QlMwvcxUTk1nRYuZQJzqz50foWdSg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728823AbgIYMtP (ORCPT ); Fri, 25 Sep 2020 08:49:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:52704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728837AbgIYMtO (ORCPT ); Fri, 25 Sep 2020 08:49:14 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 9C4E121D7A; Fri, 25 Sep 2020 12:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038154; bh=vfeYz1uzPXeSvrxX0hjIcfVWC4IOVSdlaZSE1O6JE1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZ3uibVNRJuvZmiam4vnYVSqC0O/3ycTm8QKCm0GNP/IHLtcaWtaRq0tK4B8WeuCJ jSH0bCAetGfhREtG+72JX73dpNIZLUBTxB7Lqjtr+oIo+2imUWqtjgMR6MbkwUEjDj r0GpkGn37zFGHFRRl95ktG+oHJbV3+yElK0oRDh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuang Li , Xin Long , "David S. Miller" Subject: [PATCH 5.8 22/56] net: sched: initialize with 0 before setting erspan md->u Date: Fri, 25 Sep 2020 14:48:12 +0200 Message-Id: <20200925124731.152136754@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200925124727.878494124@linuxfoundation.org> References: <20200925124727.878494124@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Xin Long [ Upstream commit 8e1b3ac4786680c2d2b5a24e38a2d714c3bcd1ef ] In fl_set_erspan_opt(), all bits of erspan md was set 1, as this function is also used to set opt MASK. However, when setting for md->u.index for opt VALUE, the rest bits of the union md->u will be left 1. It would cause to fail the match of the whole md when version is 1 and only index is set. This patch is to fix by initializing with 0 before setting erspan md->u. Reported-by: Shuang Li Fixes: 79b1011cb33d ("net: sched: allow flower to match erspan options") Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sched/cls_flower.c | 1 + 1 file changed, 1 insertion(+) --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -1215,6 +1215,7 @@ static int fl_set_erspan_opt(const struc } if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]) { nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]; + memset(&md->u, 0x00, sizeof(md->u)); md->u.index = nla_get_be32(nla); } } else if (md->version == 2) {