From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: David Miller <davem@davemloft.net>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Yehezkel Bernat <yehezkel.bernat@intel.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
Amir Levy <amir.jer.levy@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
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 [thread overview]
Message-ID: <20171025092734.51299-1-mika.westerberg@linux.intel.com> (raw)
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 <mika.westerberg@linux.intel.com>
---
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;
--
2.14.2
next reply other threads:[~2017-10-25 9:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 9:27 Mika Westerberg [this message]
2017-10-27 3:01 ` [PATCH] thunderbolt: Drop sequence number check from tb_xdomain_match() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171025092734.51299-1-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=amir.jer.levy@intel.com \
--cc=andreas.noever@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=netdev@vger.kernel.org \
--cc=yehezkel.bernat@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox