Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1589118ybl; Wed, 18 Dec 2019 22:48:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzz6927rjE+4UG8t5kj5V3R80mtqC1PL8SG8Z3HZOBMLxQKhTsnl2E3SjfyOLqMcwhPayBs X-Received: by 2002:a9d:6a8f:: with SMTP id l15mr7004723otq.59.1576738108377; Wed, 18 Dec 2019 22:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576738108; cv=none; d=google.com; s=arc-20160816; b=nyodoG5v6++5xGKPfx7ip5wb0cMVV2YIP3RDb+TaPpmrDmruOjdPJ8XOhLUKJumCsA XZuJM4GklRZuA1TYHY3zSwFX7FpIea7HYPGVV7RJcKYpdreDMRAT+pNYGR+0nhNjJoLN O/dxmwfifSbp5uvHGn0d0vCURSSHSwKJqd7A1po2h8j3nITrYQ4r+ZEq3U844kadk4oz BghzNi+g42wQBnp6Th+OtbnffS3Hm3Sn2BOW5LgYwz3Y9nfWTjzizTYIpIFZ1t/fVcFN P4v1KI1YWJ9oChPLUz18OkSn/xLu613WZ2zXVswT+CGETuTtGFrTqMu2eSBtrgHg/PdN ftMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Lrtk03jplvAQ9Ie5nWm/idroJVNY23ZaKWvUpLfbKyw=; b=0ffyFrZjpCP66rg0g50jy8ceejHzqM2sB6gYxEYjYoz+19a9SKmSQjhWr3yOVYA/iQ fvK9j2KunmFGCNXLgFyrrbSk8WnPAtSAkwXnZgPFlxGqaUF/7ZVlZ57djbQwud2JfqRV h6dX//NQ5Q6RJccQm9D6UWZGUGco67od1KvK4oILkRQiD0MNWkSMy1lArpFVxVc0ZKG1 /GQ33uopQUSdVUxnn0qRu+3Qbqv8Qq5sOCyl+JLNEB/D+sbpvjO2DPGqB+a+vXoJVZ76 woEMmhTQ8RFqr+bjECuMXRlPOajit1RnrRMhHk6uFTeuBztI5bBWYo17r4PJ4Z2HZ/tR GgYA== ARC-Authentication-Results: i=1; mx.google.com; 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 f17si2489084otq.96.2019.12.18.22.48.17; Wed, 18 Dec 2019 22:48:28 -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; 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 S1726599AbfLSGpx (ORCPT + 99 others); Thu, 19 Dec 2019 01:45:53 -0500 Received: from isilmar-4.linta.de ([136.243.71.142]:48936 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725844AbfLSGpx (ORCPT ); Thu, 19 Dec 2019 01:45:53 -0500 Received: by isilmar-4.linta.de (Postfix, from userid 1000) id 3CD452009B2; Thu, 19 Dec 2019 06:45:51 +0000 (UTC) Date: Thu, 19 Dec 2019 07:45:51 +0100 From: Dominik Brodowski To: Jia-Ju Bai Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mtd: maps: pcmciamtd: fix possible sleep-in-atomic-context bugs in pcmciamtd_set_vpp() Message-ID: <20191219064551.stdx4aoyhwsbqbjj@isilmar-4.linta.de> References: <20191219032023.7177-1-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191219032023.7177-1-baijiaju1990@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 19, 2019 at 11:20:23AM +0800, Jia-Ju Bai wrote: > The driver may sleep while holding a spinlock. > The function call path (from bottom to top) in Linux 4.19 is: > > drivers/pcmcia/pcmcia_resource.c, 312: > mutex_lock in pcmcia_fixup_vpp > drivers/mtd/maps/pcmciamtd.c, 309: > pcmcia_fixup_vpp in pcmciamtd_set_vpp > drivers/mtd/maps/pcmciamtd.c, 306: > _raw_spin_lock_irqsave in pcmciamtd_set_vpp > > drivers/pcmcia/pcmcia_resource.c, 312: > mutex_lock in pcmcia_fixup_vpp > drivers/mtd/maps/pcmciamtd.c, 312: > pcmcia_fixup_vpp in pcmciamtd_set_vpp > drivers/mtd/maps/pcmciamtd.c, 306: > _raw_spin_lock_irqsave in pcmciamtd_set_vp > > mutex_lock() may sleep at runtime. > > To fix these bugs, the spinlock is replaced with a mutex. > > These bugs are found by a static analysis tool STCheck written by > myself. > > Signed-off-by: Jia-Ju Bai Reviewed-by: Dominik Brodowski I presume this will go upstream (with CC to stable -- likely applies to all longterm kernels still maintained) via MTD? Or should I route it via pcmcia? Thanks, Dominik