Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp647629imu; Fri, 11 Jan 2019 06:46:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN6yNBNsHTmCKFfdr0nCSmK2CeUDe9LziWS8xlCpb8FArAhZzIQ+Cnbi6Mf7S5fKpD4BraD0 X-Received: by 2002:a65:4904:: with SMTP id p4mr13698179pgs.384.1547217961727; Fri, 11 Jan 2019 06:46:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547217961; cv=none; d=google.com; s=arc-20160816; b=gShMH7lJHqxGFyNXa5X4OVACyWdtdZsEVCyVnf1spqJ1Do2l7/FaJhUBjs9++v4Dcl fvgcz8Pr9OdXH62D4zITf7vCGo7YPuNKKYwRRBTQWmXaPy2bFah+fiG85inSh46JZmxe SMLP2bTPJgRUskxm8iHtUAgwYQLLLC5BxqbwkAZuz3SOQnuKwKY08F9+SMGfszrrK4cs /TsimGsepUtLZzWBmnbmzNqzims7YuBlqrsnadNMRWW0J5o6CtHUfA3VHMMC6Xvuc3R6 V7vfd+sh3/MmcMGFmKtO9fEw5HSM2PkYJSCC8vAjKmxKun2i5rwzb3plDWmZTSnaf2a6 wacQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4G1pnawT6qXBKLw7KaPgxxtGx2Gg+RFQqmLhlXTI7ME=; b=09aRuYSw+twjJHJRGgOlnhkKVcil+JP1V4iEmpRoBfkoh778nHE4C4e7D7wFt4ujlp cvZZy0xshaUaiT+2w7HkePUjWM9z0+kBrXDZux8VRClv7dKVKj2QjGWydusb0/bEwkD/ ni3VLlb9KRlwsBSR5hZ+Mr3hFSc8n3LckIJDhzfWvEdFwR0e0TDMcW16z2qPQqP32eWA BdPN7gaHPIp5UUMR3KPI7nxSjD8CFgpNouZJURvVIyh9Ur/Y933GVrdPtev0f/ObTmZw X/nvQb/huap7yKa2oZF7xK9Usfawo3zAoxqJxigjVlJHkKRscjsQboBqN99FhOQTXbC+ ANvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o7LcKh6Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6si75478584plk.231.2019.01.11.06.45.46; Fri, 11 Jan 2019 06:46:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o7LcKh6Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403833AbfAKOnz (ORCPT + 99 others); Fri, 11 Jan 2019 09:43:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:36812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404484AbfAKOnw (ORCPT ); Fri, 11 Jan 2019 09:43:52 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EFAB2063F; Fri, 11 Jan 2019 14:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547217831; bh=Ff/Smo8/gZkkvW0QLW4KBcuBONEg1vh1Gde13Zi5ASM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o7LcKh6QLQCTVg5RoGXGibzXmzdede4pF01N1HraFogzCzJ9sDoExdEOTtU6kTCSj AZrNZaSMwn3l1IiZ6DvzakGGZy3hh0JkTMAguFTDufALq85f8CCdDNkCODRUCSu/dy vrLpa6KbW77BDLFWY+IMLDgQ3jQ92IO7ykfuKzg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Borntraeger , Frank Haverkamp Subject: [PATCH 4.20 57/65] genwqe: Fix size check Date: Fri, 11 Jan 2019 15:15:43 +0100 Message-Id: <20190111131103.788169839@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131055.331350141@linuxfoundation.org> References: <20190111131055.331350141@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christian Borntraeger commit fdd669684655c07dacbdb0d753fd13833de69a33 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: Christian Borntraeger Signed-off-by: Frank Haverkamp Signed-off-by: Greg Kroah-Hartman --- drivers/misc/genwqe/card_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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, u 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,