Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp705208pxb; Mon, 25 Oct 2021 17:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0SZPB7cy+0tFAR5lVgovrhAC6lV5PrkBn5C9RZSXMkMivXPw0vDs97K4vY1mbE7B+tj1S X-Received: by 2002:a05:6402:152:: with SMTP id s18mr31533176edu.356.1635206631816; Mon, 25 Oct 2021 17:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635206631; cv=none; d=google.com; s=arc-20160816; b=imnhPneH1BL0DISX6lWcd3yJvRt2PHqQHkuzjBta//o9Sb301khqitE2weF+qgXeyo tdPxt0keHGjkSs8pLkxXYmPJwXmSJp6JPtJvZ5ov0Fvl22pZJPjvdID9zQjiGDeeqrlC 2X/FWnGxsvXsESJlJbzc1DDqMxzmENiKtQJpwGwIL7q4CAS6VbkhKcVtEu0L5UUs9qFa GyK6Yr1G6DtL7+1NHTnQsejDTt/2r9cUKf5CyI1/naHj0MCzpR6DJ2ZXHO8ALRks9//R uFP2zGoKuSFbtPlz6Y97IJ5NMAhhtaL+amyXAEuwhEMnayf3YCCztllciRS7o6On/uZj tl8w== 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=bTMl2t9QIqESobO1MPsYxP7MJvi5w17Ov6K4FKNIYm4=; b=xv8Ocy/D41/cTo88tJ9da+q/ovto3baq+Mm16+9tvcmiWz8iGIqzGunz06M59H2NBX mDoyoWmg+Y11JcwaLFNjPIlfHpGCunEaaAztRYYVrfLqyb0aB5MCHLq8Iz1TyBMr2gAF G2hdAF1jOG/tbSp0tV3hWC18frSWwxYyHaI1aSU/a4AvMxJO/R2D2LdmEDAC7UKIPDQ3 2FkMnryK3bnCnePtT9KULv9wDUfV37FdffXOhwq1pAkXrKN2WXh/eELYPrN+Apm0+hhA anlcyvDO/ipqR8/TkvVQEJ5tDYoAIq2wsjJJ322E8RN1u5+lXKQ4S43pfJL+7jh6UvY6 mcAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J871ISfd; 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 hq4si826768ejc.66.2021.10.25.17.03.12; Mon, 25 Oct 2021 17:03: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=J871ISfd; 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 S237017AbhJYTnU (ORCPT + 99 others); Mon, 25 Oct 2021 15:43:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:48094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234640AbhJYTbw (ORCPT ); Mon, 25 Oct 2021 15:31:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7D196610A6; Mon, 25 Oct 2021 19:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635190095; bh=LELVVenzFuKnFfrhshiT9VC3aNrPaT7n/lt4pzPjvkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J871ISfdxmiO84c8zbcavIijUurFSFHf3lQyiV7R/Zlr2tENHEw+qm4RBq3I4BjVI YvDOqbC+owDFU1+JBaSf8d2WBqDOlqHJyjMFwzbQgcxwY0Cizhhi2JHcJaQw0ZDgzh kwag7flm/ENagUo4xMldwDlBIzatGDNcyhobbQ/4= 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 5.4 49/58] isdn: mISDN: Fix sleeping function called from invalid context Date: Mon, 25 Oct 2021 21:15:06 +0200 Message-Id: <20211025190945.916599493@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190937.555108060@linuxfoundation.org> References: <20211025190937.555108060@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 9e6aab04f9d6..8299defff55a 100644 --- a/drivers/isdn/hardware/mISDN/netjet.c +++ b/drivers/isdn/hardware/mISDN/netjet.c @@ -949,8 +949,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