From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A2E5C00140 for ; Sun, 21 Aug 2022 20:45:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C9308E0001; Sun, 21 Aug 2022 16:45:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5782A6B0074; Sun, 21 Aug 2022 16:45:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 419658E0001; Sun, 21 Aug 2022 16:45:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2D96C6B0073 for ; Sun, 21 Aug 2022 16:45:08 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E86B612028C for ; Sun, 21 Aug 2022 20:45:07 +0000 (UTC) X-FDA: 79824779454.06.B15257F Received: from p3plwbeout15-04.prod.phx3.secureserver.net (p3plsmtp15-04-2.prod.phx3.secureserver.net [173.201.193.40]) by imf29.hostedemail.com (Postfix) with ESMTP id 4BE341200D4 for ; Sun, 21 Aug 2022 20:45:07 +0000 (UTC) Received: from mailex.mailcore.me ([94.136.40.143]) by :WBEOUT: with ESMTP id Probo5D3GA2xwProcosI7Q; Sun, 21 Aug 2022 13:45:02 -0700 X-CMAE-Analysis: v=2.4 cv=Z5UpoFdA c=1 sm=1 tr=0 ts=63029950 a=EhJYbXVJKsomWlz4CTV+qA==:117 a=84ok6UeoqCVsigPHarzEiQ==:17 a=ggZhUymU-5wA:10 a=biHskzXt2R4A:10 a=lZFbU4aQAAAA:8 a=LdWFK9ksAAAA:20 a=-XaZqyIsTfI_AlyWR7QA:9 a=yKZbCDypxrTF-tGext6c:22 X-SECURESERVER-ACCT: phillip@squashfs.org.uk X-SID: Probo5D3GA2xw Received: from 82-69-79-175.dsl.in-addr.zen.co.uk ([82.69.79.175] helo=phoenix.fritz.box) by smtp11.mailcore.me with esmtpa (Exim 4.94.2) (envelope-from ) id 1oProa-0001kp-Pc; Sun, 21 Aug 2022 21:45:01 +0100 From: Phillip Lougher To: lists@colorremedies.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Phillip Lougher Subject: Re: 6.0-rc1 BUG squashfs_decompress, and sleeping function called from invalid context at include/linux/sched/mm.h Date: Sun, 21 Aug 2022 21:44:16 +0100 Message-Id: <20220821204416.22346-1-phillip@squashfs.org.uk> X-Mailer: git-send-email 2.35.1 In-Reply-To: <73ea63fe-0c8e-412b-9fb2-94c08933180a@www.fastmail.com> References: <73ea63fe-0c8e-412b-9fb2-94c08933180a@www.fastmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailcore-Auth: 439999529 X-Mailcore-Domain: 1394945 X-123-reg-Authenticated: phillip@squashfs.org.uk X-Originating-IP: 82.69.79.175 X-CMAE-Envelope: MS4xfMmTkIN0zRV+R8slv86NC8yN0P9RWadzWGY4CeNOTKWbnSF68FCgkt/R67ykQ9iRT+YN2knOcaLr+Vw/G58OXRLS8WcIrZpIKIQa4cSx8zdQ1SE0JF7l AMiu8RQNqrQpjF8EPmnKjCAvE0plP2cq9TQJvUSrqF73JEOSts6mB1yHnkjbci4NVXjyyyP7YAoNHh/cAZAmzj+LoJGkk9pRGlE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661114707; a=rsa-sha256; cv=none; b=cv/1iHRrnMVT3zhVoQoue+/nXWHl69DbXSBDY7jZBSO6+q6S33Pp3kstUrDal9YvpzNa3P 5AWP1gbPlZiWw3eJZYFCQ+R8XyKCUS5Xl5x/shbuch8VoTt4gL5eZZlFDfpwWGBTNDvZDO DQJt6UNfI0GLcf0alTfNDaXh/2rYA3k= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=none; spf=none (imf29.hostedemail.com: domain of phillip@squashfs.org.uk has no SPF policy when checking 173.201.193.40) smtp.mailfrom=phillip@squashfs.org.uk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661114707; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rhr+9eGAxc1RkoRmR2D4pmYov1ZEl27F1T53xljHRd4=; b=YYfcsJipOlpVHcmxUpFjFFj5Z0NKeZpwo1pyvXd4fBlkmo3N5ognWgct1lLn78PJFOte7+ byJcUT4s9ssNvaSPPhhF6U7ZZaVNtbUV925Gfn2KdUyB5MzCR6WMg4xTsNbTHuQgSJcEUY UZWXgdR7tjiYZ7Ch+/SoIjJPFkqKIYg= X-Rspamd-Queue-Id: 4BE341200D4 X-Stat-Signature: 69drsxy5nw8fnwa3ucio6pcym43dokqc Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=none; spf=none (imf29.hostedemail.com: domain of phillip@squashfs.org.uk has no SPF policy when checking 173.201.193.40) smtp.mailfrom=phillip@squashfs.org.uk X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1661114707-928374 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 20/08/2022, Chris Murphy wrote: >Seeing the following on every boot with kernel 6.0-rc1, when booting a Fedora Rawhide Live ISO with qemu-kvm. Full dmesg at: >https://drive.google.com/file/d/15u38HZD9NSihIvz4P9M0W3dx6FZWq0MX/view?usp=sharing My fault, it should be fixed with the following patch (untested). I'll test and send the official patch out tomorrow. Phillip diff --git a/fs/squashfs/page_actor.c b/fs/squashfs/page_actor.c index b23b780d8f42..48c988e3f5d2 100644 --- a/fs/squashfs/page_actor.c +++ b/fs/squashfs/page_actor.c @@ -68,20 +68,9 @@ static void *handle_next_page(struct squashfs_page_actor *actor) if ((actor->next_page == actor->pages) || (actor->next_index != actor->page[actor->next_page]->index)) { - if (actor->alloc_buffer) { - void *tmp_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); - - if (tmp_buffer) { - actor->tmp_buffer = tmp_buffer; - actor->next_index++; - actor->returned_pages++; - return tmp_buffer; - } - } - actor->next_index++; actor->returned_pages++; - return ERR_PTR(-ENOMEM); + return actor->alloc_buffer ? actor->tmp_buffer : ERR_PTR(-ENOMEM); } actor->next_index++; @@ -96,11 +85,10 @@ static void *direct_first_page(struct squashfs_page_actor *actor) static void *direct_next_page(struct squashfs_page_actor *actor) { - if (actor->pageaddr) + if (actor->pageaddr) { kunmap_local(actor->pageaddr); - - kfree(actor->tmp_buffer); - actor->pageaddr = actor->tmp_buffer = NULL; + actor->pageaddr = NULL; + } return handle_next_page(actor); } @@ -121,6 +109,16 @@ struct squashfs_page_actor *squashfs_page_actor_init_special(struct squashfs_sb_ if (actor == NULL) return NULL; + if (msblk->decompressor->alloc_buffer) { + actor->tmp_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); + + if (actor->tmp_buffer == NULL) { + kfree(actor); + return NULL; + } + } else + actor->tmp_buffer = NULL; + actor->length = length ? : pages * PAGE_SIZE; actor->page = page; actor->pages = pages; @@ -128,7 +126,6 @@ struct squashfs_page_actor *squashfs_page_actor_init_special(struct squashfs_sb_ actor->returned_pages = 0; actor->next_index = page[0]->index & ~((1 << (msblk->block_log - PAGE_SHIFT)) - 1); actor->pageaddr = NULL; - actor->tmp_buffer = NULL; actor->alloc_buffer = msblk->decompressor->alloc_buffer; actor->squashfs_first_page = direct_first_page; actor->squashfs_next_page = direct_next_page; -- 2.35.1