Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2168547ybm; Thu, 23 May 2019 12:29:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyB3P5kAoVWehcAGlG0j2QUpzOzXdgLK583krBMRFXeL0UdCzMHpm2tbNzlkVqRBZupAlaz X-Received: by 2002:a62:1993:: with SMTP id 141mr105748389pfz.97.1558639755480; Thu, 23 May 2019 12:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558639755; cv=none; d=google.com; s=arc-20160816; b=z8eTm6aI/kKKpkC3/nAQcA32nqIb82kkBiNWWqfxhPAubDg9cUHGFfGO9BIe1uVXuH zrOcvqj/mM3mUkN8yQySQYZa1Gc4FqnqPWKWQLw0wkrnyvispkqxDGBePslS5JoimJoK LVY3FmCDo1oNT5t7p/g6sOvvXwiE9pcTWE7SJt8e+pQJuLhoZ+jkPCCIfv43U6dCHEmW 19wiBF8O5c5Q+SB+ymvTXr1hRNIyMBYOyQeCleldZ4KXLdJVzQLoDU3wzLNQKzHFZWUI KXsrNLddbUycuma5H+dJQJa3fOMe/ytL5fUbQTo8/ETgMQWcIpeXd5ud837KNVsc8c6I MHmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q40XfpcfGmcwOAJHIRtBw4fshqzvqm0/euMgM0BUdoY=; b=OvZL89z75reR92sSJr9gd3oYgU26Nb4yVbUuL8gEIoKYTyRti2/6TOty4Xg0S5pA0Q U2Xstq9hs9/ErAQBHRxFlNWCvbU+xkA84vt7o7k4WVh7r8dWmSiqn1MIuSsk41h7QBhj OicQSNlPD3GWe/uYpnHgSA4llJvDk/WPMKWpk9k1bH0UtPwEjPFxxoRg70dXn/nyUJ1x hor2tPhd7cujY7Ej48h1r4mla+G4+Ni0/uosEaa5Iq3Dthj53hA+SctMdHWoVLsLfFGw /aSDncxLVmhjb/hlMfBBv1lhirHQh4JaLGHvs56a0IiXoeuSDnpIsG3YUdlqis1AM7+K 2nzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PbhIqDux; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si510428pgk.379.2019.05.23.12.28.59; Thu, 23 May 2019 12:29:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PbhIqDux; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391007AbfEWT0c (ORCPT + 99 others); Thu, 23 May 2019 15:26:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:38352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390744AbfEWT03 (ORCPT ); Thu, 23 May 2019 15:26:29 -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 A69FA20868; Thu, 23 May 2019 19:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639589; bh=VX0vfVF6EuCB2RefEzmCaKE/JDFP2USXqDpZTzKjHWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbhIqDuxifJG0CiHbpcmYppa5KQFlFEydxhNRt8qt7lXZbpcY2RkJ81dGUc4X/Cyp 1ckF//h00ua4P2/uO1vViQ4UdgV6jIHzBDLr0+0BoIeWgDrRNiAeaYDkPoH74pFJ/N czbEADc0e35kfRWhGvbnTb1ndzVUzfFG5pHe8siw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmytro Linkin , Roi Dayan , Vlad Buslov , Saeed Mahameed Subject: [PATCH 5.1 021/122] net/mlx5e: Additional check for flow destination comparison Date: Thu, 23 May 2019 21:05:43 +0200 Message-Id: <20190523181707.600807137@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181705.091418060@linuxfoundation.org> References: <20190523181705.091418060@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmytro Linkin [ Upstream commit c979c445a88e1c9dd7d8f90838c10456ae4ecd09 ] Flow destination comparison has an inaccuracy: code see no difference between same vf ports, which belong to different pfs. Example: If start ping from VF0 (PF1) to VF1 (PF1) and mirror all traffic to VF0 (PF2), icmp reply to VF0 (PF1) and mirrored flow to VF0 (PF2) would be determined as same destination. It lead to creating flow handler with rule nodes, which not added to node tree. When later driver try to delete this flow rules we got kernel crash. Add comparison of vhca_id field to avoid this. Fixes: 1228e912c934 ("net/mlx5: Consider encapsulation properties when comparing destinations") Signed-off-by: Dmytro Linkin Reviewed-by: Roi Dayan Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -1386,6 +1386,8 @@ static bool mlx5_flow_dests_cmp(struct m if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT && d1->vport.num == d2->vport.num && d1->vport.flags == d2->vport.flags && + ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_VHCA_ID) ? + (d1->vport.vhca_id == d2->vport.vhca_id) : true) && ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID) ? (d1->vport.reformat_id == d2->vport.reformat_id) : true)) || (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&