Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5994694ybc; Wed, 27 Nov 2019 13:05:20 -0800 (PST) X-Google-Smtp-Source: APXvYqwNiaRLtdJKQx5SSfMagcDylhx1p5UiohkokEmy780xZrHH+qWS3zipZdTyrubxvJcedZIb X-Received: by 2002:a17:906:5448:: with SMTP id d8mr49592912ejp.79.1574888720524; Wed, 27 Nov 2019 13:05:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888720; cv=none; d=google.com; s=arc-20160816; b=gSS1gZxGN7yW2WVudf7icrGEwF7yK9VrH9+RO17CI0k3USSUaosByUbz+edce4rkcX nXRPCgqhpmSiPLtFcYIw4jNay094Z39vIUy2XpWDYKMjCzht4gIDF3W4LCMRH5ILWoPD 3QwrUUdzG2vrupRBucSMfHZmAiQg3e9oRaWoH0oERIEoVqrX6qCmHdgwqwQZcvWLSVbt waBocdFw0xhZLIfMl+ep0AiaD8sS/gpQ1DhvhU8Vga3m1oJlTPcipjd+NnQu6RZbKNPo 0JRSLRqdJfUjKsNT952vhV8QUF/sSlSmmHtfYJwlzhAlZMad6gZnDB5D8P5gIMJicRB2 6UlA== 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=ygOXM9a+gqJp2Ottpn2zOcyInSlims2N1EokpXS8oXI=; b=u/1PAmMfVrs4vducmo7WdfMZhuNsZoQtfheLNEvhV1LbVeVbFozJ7fO33k5qCVmP9P kCe0WLYXZd9yfGtRHv7AOFtU/nRvRj0VYaNb9H09iq8j+s1PmA5nAL7njIAuQHpZJGWP /SLByL10Qq5Cu+3aACtFPVyWoD3dGy3erWxRd6YCE3/QEsjgrwO1AimvbFBwjXQn9fGz kWNu6Drao8gw6x9qybzbnRtzzqCyizTeAGoEnsOjKgTB3v5o88hBWDLBlUiFcTzTOeYb URJT0s/+ZeMqtXLqs9VnDRhqmicVxVM6bZTkhGL3XvjcdPOZBkq3q/nZqjqEyhayQdLd nmqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a74s0WzO; 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 c22si10465428eja.111.2019.11.27.13.04.56; Wed, 27 Nov 2019 13:05:20 -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=a74s0WzO; 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 S1731986AbfK0VDE (ORCPT + 99 others); Wed, 27 Nov 2019 16:03:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:56002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731980AbfK0VDA (ORCPT ); Wed, 27 Nov 2019 16:03:00 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 2C85B21775; Wed, 27 Nov 2019 21:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888579; bh=d9nxKcst+qQU3OV1rFInKjs+FqAyZY6FfLLPYATbVhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a74s0WzOIWMtz0JSy7yiQvp8GpBMVHAyQlvAPZdQ+gQLDJ5Js1RZLINKcV+NQB6XF ipiTE/0Mlaoi/vHGsyng3XmfBMSP+IrEjIMEHstCF88H+CBZ1TYk8nKR9eI6ez4oSX xrytKNmmGdaUnwAIYiSCP24NGintRpgQD4+ycmM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai , Andrew Morton , Mark Fasheh , Joel Becker , Junxiao Bi , Joseph Qi , Changwei Ge , Linus Torvalds , Sasha Levin Subject: [PATCH 4.19 147/306] fs/ocfs2/dlm/dlmdebug.c: fix a sleep-in-atomic-context bug in dlm_print_one_mle() Date: Wed, 27 Nov 2019 21:29:57 +0100 Message-Id: <20191127203126.165957854@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Jia-Ju Bai [ Upstream commit 999865764f5f128896402572b439269acb471022 ] The kernel module may sleep with holding a spinlock. The function call paths (from bottom to top) in Linux-4.16 are: [FUNC] get_zeroed_page(GFP_NOFS) fs/ocfs2/dlm/dlmdebug.c, 332: get_zeroed_page in dlm_print_one_mle fs/ocfs2/dlm/dlmmaster.c, 240: dlm_print_one_mle in __dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 255: __dlm_put_mle in dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 254: spin_lock in dlm_put_ml [FUNC] get_zeroed_page(GFP_NOFS) fs/ocfs2/dlm/dlmdebug.c, 332: get_zeroed_page in dlm_print_one_mle fs/ocfs2/dlm/dlmmaster.c, 240: dlm_print_one_mle in __dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 222: __dlm_put_mle in dlm_put_mle_inuse fs/ocfs2/dlm/dlmmaster.c, 219: spin_lock in dlm_put_mle_inuse To fix this bug, GFP_NOFS is replaced with GFP_ATOMIC. This bug is found by my static analysis tool DSAC. Link: http://lkml.kernel.org/r/20180901112528.27025-1-baijiaju1990@gmail.com Signed-off-by: Jia-Ju Bai Reviewed-by: Andrew Morton Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Joseph Qi Cc: Changwei Ge Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/ocfs2/dlm/dlmdebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index 9b984cae4c4e0..1d6dc8422899b 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c @@ -329,7 +329,7 @@ void dlm_print_one_mle(struct dlm_master_list_entry *mle) { char *buf; - buf = (char *) get_zeroed_page(GFP_NOFS); + buf = (char *) get_zeroed_page(GFP_ATOMIC); if (buf) { dump_mle(mle, buf, PAGE_SIZE - 1); free_page((unsigned long)buf); -- 2.20.1