• Christian Borntraeger's avatar
    genwqe: Fix size check · a1fe7110
    Christian Borntraeger authored
    commit fdd66968 upstream.
    
    Calling the test program genwqe_cksum with the default buffer size of
    2MB triggers the following kernel warning on s390:
    
    WARNING: CPU: 30 PID: 9311 at mm/page_alloc.c:3189 __alloc_pages_nodemask+0x45c/0xbe0
    CPU: 30 PID: 9311 Comm: genwqe_cksum Kdump: loaded Not tainted 3.10.0-957.el7.s390x #1
    task: 00000005e5d13980 ti: 00000005e7c6c000 task.ti: 00000005e7c6c000
    Krnl PSW : 0704c00180000000 00000000002780ac (__alloc_pages_nodemask+0x45c/0xbe0)
               R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
    Krnl GPRS: 00000000002932b8 0000000000b73d7c 0000000000000010 0000000000000009
               0000000000000041 00000005e7c6f9b8 0000000000000001 00000000000080d0
               0000000000000000 0000000000b70500 0000000000000001 0000000000000000
               0000000000b70528 00000000007682c0 0000000000277df2 00000005e7c6f9a0
    Krnl Code: 000000000027809e: de7195001000	ed	1280(114,%r9),0(%r1)
    	   00000000002780a4: a774fead		brc	7,277dfe
    	  #00000000002780a8: a7f40001		brc	15,2780aa
    	  >00000000002780ac: 92011000		mvi	0(%r1),1
    	   00000000002780b0: a7f4fea7		brc	15,277dfe
    	   00000000002780b4: 9101c6b6		tm	1718(%r12),1
    	   00000000002780b8: a784ff3a		brc	8,277f2c
    	   00000000002780bc: a7f4fe2e		brc	15,277d18
    Call Trace:
    ([<0000000000277df2>] __alloc_pages_nodemask+0x1a2/0xbe0)
     [<000000000013afae>] s390_dma_alloc+0xfe/0x310
     [<000003ff8065f362>] __genwqe_alloc_consistent+0xfa/0x148 [genwqe_card]
     [<000003ff80658f7a>] genwqe_mmap+0xca/0x248 [genwqe_card]
     [<00000000002b2712>] mmap_region+0x4e2/0x778
     [<00000000002b2c54>] do_mmap+0x2ac/0x3e0
     [<0000000000292d7e>] vm_mmap_pgoff+0xd6/0x118
     [<00000000002b081c>] SyS_mmap_pgoff+0xdc/0x268
     [<00000000002b0a34>] SyS_old_mmap+0x8c/0xb0
     [<000000000074e518>] sysc_tracego+0x14/0x1e
     [<000003ffacf87dc6>] 0x3ffacf87dc6
    
    turns out the check in __genwqe_alloc_consistent uses "> MAX_ORDER"
    while the mm code uses ">= MAX_ORDER". Fix genwqe.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: default avatarFrank Haverkamp <haver@linux.vnet.ibm.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    a1fe7110
card_utils.c 27.2 KB