Re: [PATCH] genwqe: Fix size check
From: Christian Borntraeger
Date: Wed Dec 12 2018 - 09:37:06 EST
On 12.12.2018 15:18, haver wrote:
> Hi Christian,
>
> On 2018-12-12 14:45, Christian Borntraeger wrote:
>> 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@xxxxxxxxxxxxxxx
>> Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
>> ---
>> Âdrivers/misc/genwqe/card_utils.c | 2 +-
>> Â1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c
>> index 3fcb9a2fe1c9..efe2fb72d54b 100644
>> --- a/drivers/misc/genwqe/card_utils.c
>> +++ b/drivers/misc/genwqe/card_utils.c
>> @@ -215,7 +215,7 @@ u32 genwqe_crc32(u8 *buff, size_t len, u32 init)
>> Âvoid *__genwqe_alloc_consistent(struct genwqe_dev *cd, size_t size,
>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ dma_addr_t *dma_handle)
>> Â{
>> -ÂÂÂ if (get_order(size) > MAX_ORDER)
>> +ÂÂÂ if (get_order(size) >= MAX_ORDER)
>> ÂÂÂÂÂÂÂÂ return NULL;
>>
>> ÂÂÂÂ return dma_zalloc_coherent(&cd->pci_dev->dev, size, dma_handle,
>
> Thanks for sending a fix for this ugly message.
> Regards
>
> Frank
>
> Signed-off-by: Frank Haverkamp <haver@xxxxxxxxxxxxxxxxxx>
This should have been an Acked-by, I guess.
Will this go via Gregs misc driver tree?
Christian