From patchwork Sun Apr 22 16:23:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10355785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E16AE60231 for ; Sun, 22 Apr 2018 16:33:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D08DB28949 for ; Sun, 22 Apr 2018 16:33:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C41D728964; Sun, 22 Apr 2018 16:33:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id D98AD28949 for ; Sun, 22 Apr 2018 16:33:36 +0000 (UTC) Received: (qmail 19593 invoked by uid 550); 22 Apr 2018 16:31:37 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 18100 invoked from network); 22 Apr 2018 16:31:26 -0000 Message-Id: <20180422162512.458372618@linutronix.de> User-Agent: quilt/0.63-1 Date: Sun, 22 Apr 2018 18:23:47 +0200 From: Thomas Gleixner To: LKML Cc: Kees Cook , Segher Boessenkool , Kernel Hardening , Andrew Morton , Boris Brezillon , Richard Weinberger , David Woodhouse , Alasdair Kergon , Mike Snitzer , Anton Vorontsov , Colin Cross , Tony Luck , Neil Brown Subject: [patch V3 02/10] dm/verity_fec: Use GFP aware reed solomon init References: <20180422162345.004292133@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline; filename=dm-verity_fec--Use-GFP-aware-reed-solomon-init.patch X-Virus-Scanned: ClamAV using ClamSMTP Allocations from the rs_pool can invoke init_rs() from the mempool allocation callback. This is problematic in fec_alloc_bufs() which invokes mempool_alloc() with GFP_NOIO to prevent a swap deadlock because init_rs() uses GFP_KERNEL allocations. Switch it to init_rs_gfp() and invoke it with the gfp_t flags which are handed in from the allocator. Note: This is not a problem today because the rs control struct is shared between the instances and its created when the mempool is initialized. But the upcoming changes which switch to a rs_control struct per instance to embed decoder buffers will trigger the swap vs. GFP_KERNEL issue. Signed-off-by: Thomas Gleixner Cc: Mike Snitzer Cc: Alasdair Kergon Cc: Neil Brown --- drivers/md/dm-verity-fec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/md/dm-verity-fec.c +++ b/drivers/md/dm-verity-fec.c @@ -570,7 +570,7 @@ static void *fec_rs_alloc(gfp_t gfp_mask { struct dm_verity *v = (struct dm_verity *)pool_data; - return init_rs(8, 0x11d, 0, 1, v->fec->roots); + return init_rs_gfp(8, 0x11d, 0, 1, v->fec->roots, gfp_mask); } static void fec_rs_free(void *element, void *pool_data)