]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/pci: enforce fmb page boundary rule
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Mon, 14 Mar 2016 14:47:23 +0000 (15:47 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 30 Apr 2016 22:05:58 +0000 (00:05 +0200)
commit 80c544ded25ac14d7cc3e555abb8ed2c2da99b84 upstream.

The function measurement block must not cross a page boundary. Ensure
that by raising the alignment requirement to the smallest power of 2
larger than the size of the fmb.

Fixes: d0b088531 ("s390/pci: performance statistics and debug infrastructure")
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/s390/include/asm/pci.h
arch/s390/pci/pci.c

index 7672152a93acd5c986f6a7c555dd2e164e6e23bd..d2d23f88464fd19fcc08358760702622d8272f23 100644 (file)
@@ -44,7 +44,7 @@ struct zpci_fmb {
        u64 rpcit_ops;
        u64 dma_rbytes;
        u64 dma_wbytes;
-} __packed __aligned(16);
+} __packed __aligned(64);
 
 #define ZPCI_MSI_VEC_BITS      11
 #define ZPCI_MSI_VEC_MAX       (1 << ZPCI_MSI_VEC_BITS)
index 7558654ed33ea4a3e8a513a2bf3b2213265ba572..950e7e3507803a0b19a9798c6205ea71a27f21ed 100644 (file)
@@ -845,8 +845,11 @@ static inline int barsize(u8 size)
 
 static int zpci_mem_init(void)
 {
+       BUILD_BUG_ON(!is_power_of_2(__alignof__(struct zpci_fmb)) ||
+                    __alignof__(struct zpci_fmb) < sizeof(struct zpci_fmb));
+
        zdev_fmb_cache = kmem_cache_create("PCI_FMB_cache", sizeof(struct zpci_fmb),
-                               16, 0, NULL);
+                                          __alignof__(struct zpci_fmb), 0, NULL);
        if (!zdev_fmb_cache)
                goto error_zdev;