Received: by 10.223.185.116 with SMTP id b49csp6350519wrg; Wed, 28 Feb 2018 08:01:31 -0800 (PST) X-Google-Smtp-Source: AG47ELsQVRUJSKHSTMKPFiVNcdVNxourLyuhW/sFplE6xrcdJkgUSLBXCUmkqUOd6nXNfiG+18NC X-Received: by 2002:a17:902:b704:: with SMTP id d4-v6mr1675219pls.406.1519833691273; Wed, 28 Feb 2018 08:01:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519833691; cv=none; d=google.com; s=arc-20160816; b=RGGORv0F/cG710RuZR6gBNLABlvHfinOPxIqfnHHU6Nj6FLJG4Lg6NffJj85i/hO8t f2MZrUK7/j9ctsplBggahORo8PNNc3p7ZvF9GJ6ddtgtPPpHJ33T8hgV0xCNy6gAOuJ8 Js9iPeuae0Wx7LFC08klGCNwxtrn46D2Mh5znmxiMyD7O4LhsK94OsHTek6/O1BYbeNy dJ0o71MpNQ3ctcSoQl8tnd8nwzQXNaiBeeXOSIPp9oSmtIq3Fw2k2bi1MIE9eDDVEgVU wq0t2YKuQ7Hg2ucbDqcI3lfWJQQG22hxogi92c3OvL8I5GGgIx3TepoKO3jdl0IgoHsz U0rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=jat1zsMS8BWZaN8Kvx/aIInYT/ET0a0TsGfFlLzL9Sg=; b=PGIVOv6xA4WshxRVrbjl1HSdW3ZFVhtS8C/vIuElzCRBE657TWZqtsMVlZ9fmwHerz 17FQgalxG4OGsEhr9IxNVfso7OoXcnjvpXnzTpPsNlR0qWZVm6PHv3j8Hj7P0MiMYv/m 4nmGQn6dxBNh/vxndjfzroC1BXmRJ2U9HqX1GcJrqnZULdhWlDfIghFPRb6Hu84fYHTj DNC47UbgEk5+EQdRnzJjDzaSwI2YVo97YO1lS0TCIULNXcL0XTxaRS1j22VoUc/WPwRt SymSDjPxEfn+Fzbj6Kf2hAl1uSn3F1tfiAF7pp+bPDy/hAXrrCU0w4PlrQkSg1ypxxEu wh+g== ARC-Authentication-Results: i=1; mx.google.com; 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 k3si1447917pfj.24.2018.02.28.08.01.06; Wed, 28 Feb 2018 08:01:31 -0800 (PST) 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; 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 S932413AbeB1QAW (ORCPT + 99 others); Wed, 28 Feb 2018 11:00:22 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34651 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753064AbeB1QAU (ORCPT ); Wed, 28 Feb 2018 11:00:20 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yv-0006XT-As; Wed, 28 Feb 2018 15:22:33 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yd-0008Mb-2b; Wed, 28 Feb 2018 15:22:15 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Christoph Hellwig" , "Martin K. Petersen" , "Huacai Chen" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 010/254] scsi: libsas: align sata_device's rps_resp on a cacheline In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Huacai Chen commit c2e8fbf908afd81ad502b567a6639598f92c9b9d upstream. The rps_resp buffer in ata_device is a DMA target, but it isn't explicitly cacheline aligned. Due to this, adjacent fields can be overwritten with stale data from memory on non-coherent architectures. As a result, the kernel is sometimes unable to communicate with an SATA device behind a SAS expander. Fix this by ensuring that the rps_resp buffer is cacheline aligned. This issue is similar to that fixed by Commit 84bda12af31f93 ("libata: align ap->sector_buf") and Commit 4ee34ea3a12396f35b26 ("libata: Align ata_device's id on a cacheline"). Signed-off-by: Huacai Chen Signed-off-by: Christoph Hellwig Signed-off-by: Martin K. Petersen [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- include/scsi/libsas.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -170,11 +170,11 @@ enum ata_command_set { struct sata_device { enum ata_command_set command_set; - struct smp_resp rps_resp; /* report_phy_sata_resp */ u8 port_no; /* port number, if this is a PM (Port) */ struct ata_port *ap; struct ata_host ata_host; + struct smp_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */ u8 fis[ATA_RESP_FIS_SIZE]; };