Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp676393pxb; Mon, 25 Oct 2021 16:27:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW21/RBBmV85O3VCQ1nS47I/DOabUzPRIpfEHMGt9qPE8gwNqvylO0ozwybWO0d13uz4p8 X-Received: by 2002:a17:907:6ea6:: with SMTP id sh38mr25392766ejc.408.1635204471770; Mon, 25 Oct 2021 16:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635204471; cv=none; d=google.com; s=arc-20160816; b=lSLde7IBG9EqIb4LjWq6RGIEyTsX1sHFZg8g5YVlSR0yoqC65Gu9ZG33HPMl5SZGyH 5gS1lYoE0G2J4gH8MnikfFC8i/bBEXNnq5zA97wK7a1q63PCyFuECfLRCVgyI1hjUrfv u6f4qPPNRBO5LbTtL56vHsfOkltDsmSOEBL52kegMSKLhVo/vcWgJ4jNo0npkJHEJjbO kvv0Fb8OpPNNI6wD5ffAB+QvI8E2B5ZtCKKiW13J1jHTorENtkb7DbHkRy1JH+F0nlCE sN8f7f4frzcJ4EfsWU84NNzBcrSxrFOqlbjrGfY8d2vNkyTH9iPrMGQC7ugAnj12byxV 5yxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YQUn6qmeDmY27miW8wKJI7MeN7LyJH9bwBwn3/oA8HE=; b=kdpHGIP43nb4pm1lSv+nFxtb5sj9G9zQaw/NKwlv1Q1HrdGyaWoECqKdnFXHwkgre1 9tu4I3wCC93+ZFEsq3pFfTwpDUxPWzOfQ41f7IZpBnh54gircCqteU4iZKdRSZDteQZq E3ubvjIiFFSI8+NMAwRsqg5WbsRsyVKWyHrki1NTUofxkXVFSBGsaim7ubzS1lEX4gC/ q9SCSWFyVKVak2bzftcoRsKUrUbCLH6IIE2l2w8irvnfB/s2w0GrAh7fLSnRn2mdoWHE +vKuvzPHRCRRMIgUQ59T9xFuXBo8S0peQFcBf4ZIJDxqJml/40z7Wuc/5/U7ZMTkf/Vh CTzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JJOAJCzR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si39197205edc.228.2021.10.25.16.27.28; Mon, 25 Oct 2021 16:27:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JJOAJCzR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235093AbhJYTZ0 (ORCPT + 99 others); Mon, 25 Oct 2021 15:25:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234145AbhJYTWX (ORCPT ); Mon, 25 Oct 2021 15:22:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CF185610FC; Mon, 25 Oct 2021 19:20:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189601; bh=1hDDKPFMJeNG8aC4u1Bz+JJb9z8HGt06R9e7A0KG3hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJOAJCzRhZ5ddof1czv3upu2oR5npae353iKM2zsntTbQPd6lFnlz2K6RpehNZEAh R5aQsGLInyRoDyjla7O4u9p9DL26uvLDJZO4WbkNHsfQjYmSy2stSk1Itbqv5ykkfJ maz+5CpTE1KVbzqfHvjs2nYdrZvm02CZ2GhzAwtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 44/50] isdn: mISDN: Fix sleeping function called from invalid context Date: Mon, 25 Oct 2021 21:14:31 +0200 Message-Id: <20211025190940.711805032@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190932.542632625@linuxfoundation.org> References: <20211025190932.542632625@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zheyu Ma [ Upstream commit 6510e80a0b81b5d814e3aea6297ba42f5e76f73c ] The driver can call card->isac.release() function from an atomic context. Fix this by calling this function after releasing the lock. The following log reveals it: [ 44.168226 ] BUG: sleeping function called from invalid context at kernel/workqueue.c:3018 [ 44.168941 ] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 5475, name: modprobe [ 44.169574 ] INFO: lockdep is turned off. [ 44.169899 ] irq event stamp: 0 [ 44.170160 ] hardirqs last enabled at (0): [<0000000000000000>] 0x0 [ 44.170627 ] hardirqs last disabled at (0): [] copy_process+0x132d/0x3e00 [ 44.171240 ] softirqs last enabled at (0): [] copy_process+0x135a/0x3e00 [ 44.171852 ] softirqs last disabled at (0): [<0000000000000000>] 0x0 [ 44.172318 ] Preemption disabled at: [ 44.172320 ] [] nj_release+0x69/0x500 [netjet] [ 44.174441 ] Call Trace: [ 44.174630 ] dump_stack_lvl+0xa8/0xd1 [ 44.174912 ] dump_stack+0x15/0x17 [ 44.175166 ] ___might_sleep+0x3a2/0x510 [ 44.175459 ] ? nj_release+0x69/0x500 [netjet] [ 44.175791 ] __might_sleep+0x82/0xe0 [ 44.176063 ] ? start_flush_work+0x20/0x7b0 [ 44.176375 ] start_flush_work+0x33/0x7b0 [ 44.176672 ] ? trace_irq_enable_rcuidle+0x85/0x170 [ 44.177034 ] ? kasan_quarantine_put+0xaa/0x1f0 [ 44.177372 ] ? kasan_quarantine_put+0xaa/0x1f0 [ 44.177711 ] __flush_work+0x11a/0x1a0 [ 44.177991 ] ? flush_work+0x20/0x20 [ 44.178257 ] ? lock_release+0x13c/0x8f0 [ 44.178550 ] ? __kasan_check_write+0x14/0x20 [ 44.178872 ] ? do_raw_spin_lock+0x148/0x360 [ 44.179187 ] ? read_lock_is_recursive+0x20/0x20 [ 44.179530 ] ? __kasan_check_read+0x11/0x20 [ 44.179846 ] ? do_raw_spin_unlock+0x55/0x900 [ 44.180168 ] ? ____kasan_slab_free+0x116/0x140 [ 44.180505 ] ? _raw_spin_unlock_irqrestore+0x41/0x60 [ 44.180878 ] ? skb_queue_purge+0x1a3/0x1c0 [ 44.181189 ] ? kfree+0x13e/0x290 [ 44.181438 ] flush_work+0x17/0x20 [ 44.181695 ] mISDN_freedchannel+0xe8/0x100 [ 44.182006 ] isac_release+0x210/0x260 [mISDNipac] [ 44.182366 ] nj_release+0xf6/0x500 [netjet] [ 44.182685 ] nj_remove+0x48/0x70 [netjet] [ 44.182989 ] pci_device_remove+0xa9/0x250 Signed-off-by: Zheyu Ma Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/hardware/mISDN/netjet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c index 6dea4c180c49..feada9d7cbcc 100644 --- a/drivers/isdn/hardware/mISDN/netjet.c +++ b/drivers/isdn/hardware/mISDN/netjet.c @@ -963,8 +963,8 @@ nj_release(struct tiger_hw *card) nj_disable_hwirq(card); mode_tiger(&card->bc[0], ISDN_P_NONE); mode_tiger(&card->bc[1], ISDN_P_NONE); - card->isac.release(&card->isac); spin_unlock_irqrestore(&card->lock, flags); + card->isac.release(&card->isac); release_region(card->base, card->base_s); card->base_s = 0; } -- 2.33.0