From patchwork Wed Oct 25 09:27:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 830157 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yMPtl6yxFz9sNx for ; Wed, 25 Oct 2017 20:27:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932409AbdJYJ1l (ORCPT ); Wed, 25 Oct 2017 05:27:41 -0400 Received: from mga14.intel.com ([192.55.52.115]:20736 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932253AbdJYJ1j (ORCPT ); Wed, 25 Oct 2017 05:27:39 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2017 02:27:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,431,1503385200"; d="scan'208";a="327451544" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 25 Oct 2017 02:27:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 12E67195; Wed, 25 Oct 2017 12:27:34 +0300 (EEST) From: Mika Westerberg To: David Miller Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , Dan Carpenter , Amir Levy , Mika Westerberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thunderbolt: Drop sequence number check from tb_xdomain_match() Date: Wed, 25 Oct 2017 12:27:34 +0300 Message-Id: <20171025092734.51299-1-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.14.2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit 9a03c3d398c1 ("thunderbolt: Fix a couple right shifting to zero bugs") revealed an issue that was previously hidden because we never actually compared received XDomain message sequence numbers properly. The idea with these sequence numbers is that the responding host uses the same sequence number that was in the request packet which we can then check at the requesting host. However, testing against macOS it looks like it does not follow this but instead uses some other logic. Windows driver on the other hand handles it the same way than Linux. In order to be able to talk to macOS again, fix this so that we drop the whole sequence number check. This effectively works exactly the same than it worked before the aforementioned commit. This also follows the logic the original P2P networking code used. Signed-off-by: Mika Westerberg --- This applies on top of net-next.git/master. drivers/thunderbolt/xdomain.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c index ff8d91189e99..f25d88d4552b 100644 --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c @@ -56,7 +56,6 @@ static bool tb_xdomain_match(const struct tb_cfg_request *req, case TB_CFG_PKG_XDOMAIN_RESP: { const struct tb_xdp_header *res_hdr = pkg->buffer; const struct tb_xdp_header *req_hdr = req->request; - u32 req_seq, res_seq; if (pkg->frame.size < req->response_size / 4) return false; @@ -68,14 +67,6 @@ static bool tb_xdomain_match(const struct tb_cfg_request *req, if ((res_hdr->xd_hdr.route_lo) != req_hdr->xd_hdr.route_lo) return false; - /* Then check that the sequence number matches */ - res_seq = res_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK; - res_seq >>= TB_XDOMAIN_SN_SHIFT; - req_seq = req_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK; - req_seq >>= TB_XDOMAIN_SN_SHIFT; - if (res_seq != req_seq) - return false; - /* Check that the XDomain protocol matches */ if (!uuid_equal(&res_hdr->uuid, &req_hdr->uuid)) return false;