genwqe: Fix size check
Subsystems (2)
PATCH 1/1 genwqe: Fix size check
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>] 0x3ffacf87dc6turns out the check in __genwqe_alloc_consistent uses "> MAX_ORDER" while the mm code uses ">= MAX_ORDER". Fix genwqe.
--- drivers/misc/genwqe/card_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/genwqe/card_utils.c +1 -1
@@ -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,
Signature · 1 line
2.19.1
Hi Christian,
Quoted 54 lines · Christian Borntraeger
Calling the test program
genwqe_cksumwith 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 tainted3.10.0-957.el7.s390x #1
task:00000005e5d13980ti:00000005e7c6c000task.ti:00000005e7c6c000Krnl PSW :0704c0018000000000000000002780ac(__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>] 0x3ffacf87dc6turns out the check in
__genwqe_alloc_consistentuses ">MAX_ORDER" while the mm code uses ">=MAX_ORDER". Fix genwqe.Signed-off-by Christian Borntraeger <[email protected]>--- drivers/misc/genwqe/card_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/misc/genwqe/card_utils.c +0
-0
drivers/misc/genwqe/card_utils.c u32 genwqe_crc32(u8 *buff, size_t len, u32 init) · line 221
Quoted 8 lines
drivers/misc/genwqe/card_utils.c +1
-1@@ -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
Quoted 60 lines · haver
Hi Christian,
Quoted 57 lines · Christian Borntraeger
Calling the test program
genwqe_cksumwith 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 tainted3.10.0-957.el7.s390x #1
task:00000005e5d13980ti:00000005e7c6c000task.ti:00000005e7c6c000Krnl PSW :0704c0018000000000000000002780ac(__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:00000000002932b80000000000b73d7c0000000000000010 0000000000000009 000000000000004100000005e7c6f9b8000000000000000100000000000080d000000000000000000000000000b705000000000000000001 00000000000000000000000000b7052800000000007682c00000000000277df200000005e7c6f9a0Krnl Code:000000000027809e: de7195001000 ed 1280(114,%r9),0(%r1)00000000002780a4: a774fead brc 7,277dfe #00000000002780a8: a7f40001 brc 15,2780aa >00000000002780ac: 92011000 mvi 0(%r1),100000000002780b0: a7f4fea7 brc 15,277dfe00000000002780b4: 9101c6b6 tm 1718(%r12),100000000002780b8: a784ff3a brc 8,277f2c00000000002780bc: a7f4fe2e brc 15,277d18Call 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>]
0x3ffacf87dc6turns out the check in
__genwqe_alloc_consistentuses ">MAX_ORDER" while the mm code uses ">=MAX_ORDER". Fix genwqe.Signed-off-by Christian Borntraeger <[email protected]>---
drivers/misc/genwqe/card_utils.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/misc/genwqe/card_utils.c +1
-1@@ -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;
Quoted 8 lines
drivers/misc/genwqe/card_utils.c u32 genwqe_crc32(u8 *buff, size_t len, u32 init) · line 221
Quoted 1 line
drivers/misc/genwqe/card_utils.c +0
-0return dma_zalloc_coherent(&cd->pci_dev->dev, size, dma_handle,Thanks for sending a fix for this ugly message.
RegardsFrank
Signed-off-by Frank Haverkamp <[email protected]>
This should have been an Acked-by, I guess.
Will this go via Gregs misc driver tree?
Christian
Greg Kroah-Hartman
maintainerQuoted 66 lines · Christian Borntraeger
Quoted 65 lines · haver
Hi Christian,
Quoted 50 lines · Christian Borntraeger
Calling the test program
genwqe_cksumwith 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 tainted3.10.0-957.el7.s390x #1
task:00000005e5d13980ti:00000005e7c6c000task.ti:00000005e7c6c000Krnl PSW :0704c0018000000000000000002780ac(__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:00000000002932b80000000000b73d7c0000000000000010 0000000000000009 000000000000004100000005e7c6f9b8000000000000000100000000000080d000000000000000000000000000b705000000000000000001 00000000000000000000000000b7052800000000007682c00000000000277df200000005e7c6f9a0Krnl Code:000000000027809e: de7195001000 ed 1280(114,%r9),0(%r1)00000000002780a4: a774fead brc 7,277dfe #00000000002780a8: a7f40001 brc 15,2780aa >00000000002780ac: 92011000 mvi 0(%r1),100000000002780b0: a7f4fea7 brc 15,277dfe00000000002780b4: 9101c6b6 tm 1718(%r12),100000000002780b8: a784ff3a brc 8,277f2c00000000002780bc: a7f4fe2e brc 15,277d18Call 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>]
0x3ffacf87dc6turns out the check in
__genwqe_alloc_consistentuses ">MAX_ORDER" while the mm code uses ">=MAX_ORDER". Fix genwqe.Signed-off-by Christian Borntraeger <[email protected]>---
drivers/misc/genwqe/card_utils.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/misc/genwqe/card_utils.c +0
-0drivers/misc/genwqe/card_utils.c u32 genwqe_crc32(u8 *buff, size_t len, u32 init) · line 221
Quoted 8 lines
drivers/misc/genwqe/card_utils.c +1
-1@@ -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
Quoted 6 lines
Quoted 3 lines
Frank
Signed-off-by Frank Haverkamp <[email protected]>This should have been an Acked-by, I guess.
Will this go via Gregs misc driver tree?
Yes, I can take it, thanks.
greg k-h