]> git.kernelconcepts.de Git - karo-tx-linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 16:08:37 +0000 (09:08 -0700)
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/include/asm/pci.h
arch/s390/pci/pci.c

index c873e682b67f8e4063628a1726a896a167a9d8c4..2b2ced9dc00a6cb9d749b3d9027d47a8a1d08684 100644 (file)
@@ -45,7 +45,7 @@ struct zpci_fmb {
        u64 rpcit_ops;
        u64 dma_rbytes;
        u64 dma_wbytes;
-} __packed __aligned(16);
+} __packed __aligned(64);
 
 enum zpci_state {
        ZPCI_FN_STATE_RESERVED,
index 7ef12a3ace3aef665bd7b1bb637cc0d9dafcc6bd..19442395f413b061c36ed848c0962c09624b7282 100644 (file)
@@ -871,8 +871,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;