Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4262047imm; Wed, 30 May 2018 02:08:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ+n16hQyqoMGbEIxUInjI7qyiGKa7Zky+qhrezRFH5BGF/rGxJhxrFdXlaB5vqI9WSiRJS X-Received: by 2002:a17:902:b410:: with SMTP id x16-v6mr2059852plr.324.1527671337274; Wed, 30 May 2018 02:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527671337; cv=none; d=google.com; s=arc-20160816; b=F6nNX4FeeIMxaVmk5QkKiQgq+d0dCPRB8y19v1pqMwV2ZQ7SgLarUebtKz514aADuf MhXs1c9hmW2RGL2smoFNH9SamefjE9Xv0eiZJzIo0aipYQZxkl9QmmGFF3Q5ctZTkNuE P4n2W2Z6O4+mv/C3f+SNmPwq9qY4R+kUMY7+wv1HXPnzrUj10FuDvQcCmNlWK7CDvYPr VPy8i4FqofegF7JeQEGVrdDjCXqrtGKCuIsLk3nfcutq+Z18seDV7L/+IgAM8UrpbsiK c73kMSPvqflvocFlJo1LAWKdGiX/m8Zwnr4q+0d/LW1geXmfpZ7geXXV2ufUpRjpMilC hJjg== 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:dkim-signature:arc-authentication-results; bh=GQdAGUgbl9U5Wk6lpMq3F7W9L08B099VqoL94JxZbCw=; b=LIE1rxeG9wc5E5ksBPaTLw1hUvQGviDhN2L2JYncRfGJ+yDyA5CQ3YREVbbJMACgYW GoKnn45ZU09HUun3Km9V7+68ecXLJ9uJmokA6dNEYGCwQ9CbrJ1OfAMXG9seaZmcyhEt SXCrC5CRZDzLS5jX6p7xxkSN/8hEvl88l3B4MQQDaXRl6RrfX8FGeTCmILEF1Z5ElQHG b1lstMwXFgSgV5Se4dJ5InbxnHlQCCDVVKbusrUB/ult//uGCGOTM+bozhJQ9FAiKkjv 0waY6u2fLKvQqN08/33/yOFORbACibpZl/lrm7CIZhVlomIDPZgNOrEcyUnlb9KWJGaV Z0cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rJHPXiw1; 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 t12-v6si14958292pgq.41.2018.05.30.02.08.43; Wed, 30 May 2018 02:08:57 -0700 (PDT) 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=@amarulasolutions.com header.s=google header.b=rJHPXiw1; 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 S968694AbeE3JGo (ORCPT + 99 others); Wed, 30 May 2018 05:06:44 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53438 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965188AbeE3JGj (ORCPT ); Wed, 30 May 2018 05:06:39 -0400 Received: by mail-wm0-f67.google.com with SMTP id a67-v6so46226242wmf.3 for ; Wed, 30 May 2018 02:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GQdAGUgbl9U5Wk6lpMq3F7W9L08B099VqoL94JxZbCw=; b=rJHPXiw1JUm8DNn+O7wbdtjr0JJRkVZJWQ50ff7/43S9SZPYgTVmrahmuGODy7iF+w 3oLHJRW2XYzfgirdXfvp6dsl9GGVGKWUJhzp/Nad+/jojAVOxd0jmF7HyoMoZ0qElppd d9qPI1cUV3ALoIjnaNJYKE8jzQkhDrkVhPBVE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GQdAGUgbl9U5Wk6lpMq3F7W9L08B099VqoL94JxZbCw=; b=QSSb8TKu6jRvNC8MUwV8yc7d5DB6a0BlZ9KN7iygNXQ8tFhWZN7KXm+yBsL0UojcKH hd7GkBLW6TFlyiZMOZXt2DT2gWZ4vhueTlwgkM8QAT+I46DcT4Kg/spYqZSwWQmC8i/1 cR0BJqWbYj6gWnEfqd8MiAMYzO1+TaIIUmnS8PIGQAgupEHEuhoRBevpqKwCeZwNEWOx ahnkevUZsWp9rpDbbgVRFlAafXxXfwaYGi6BmrdBhXgnlfiyZHNitWVo7Y3CnbmXyREy 95KfM/PS7CrujJpfDTaY7byj0a5ZAF5lv3DUhBECxEiuZKk4skpmr4gczDVfzBKkqYm5 oupg== X-Gm-Message-State: ALKqPwcealgB4WChNcLvjr18CsMtph0UyvS+CKlGQpK5Stsed5B0Y+Av hzH3wB42ZV6MVI/W8g3qx3a9eg== X-Received: by 2002:a1c:a104:: with SMTP id k4-v6mr833512wme.106.1527671198218; Wed, 30 May 2018 02:06:38 -0700 (PDT) Received: from panicking (ip-163-227.sn-213-198.clouditalia.com. [213.198.163.227]) by smtp.gmail.com with ESMTPSA id x63-v6sm28305765wma.25.2018.05.30.02.06.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 02:06:37 -0700 (PDT) Date: Wed, 30 May 2018 11:06:34 +0200 From: Michael Trimarchi To: Arend van Spriel Cc: Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Kalle Valo , "David S. Miller" , Pieter-Paul Giesberts , Ian Molton , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2] brcmfmac: stop watchdog before detach and free everything Message-ID: <20180530090633.GA15390@panicking> References: <1527493857-2220-1-git-send-email-michael@amarulasolutions.com> <5B0D1C9E.4000800@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5B0D1C9E.4000800@broadcom.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using built-in in kernel image without a firmware in filesystem or in the kernel image can lead to a kernel NULL pointer deference. Watchdog need to be stopped in brcmf_sdio_remove The system is going down NOW! [ 1348.110759] Unable to handle kernel NULL pointer dereference at virtual address 000002f8 Sent SIGTERM to all processes [ 1348.121412] Mem abort info: [ 1348.126962] ESR = 0x96000004 [ 1348.130023] Exception class = DABT (current EL), IL = 32 bits [ 1348.135948] SET = 0, FnV = 0 [ 1348.138997] EA = 0, S1PTW = 0 [ 1348.142154] Data abort info: [ 1348.145045] ISV = 0, ISS = 0x00000004 [ 1348.148884] CM = 0, WnR = 0 [ 1348.151861] user pgtable: 4k pages, 48-bit VAs, pgdp = (____ptrval____) [ 1348.158475] [00000000000002f8] pgd=0000000000000000 [ 1348.163364] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 1348.168927] Modules linked in: ipv6 [ 1348.172421] CPU: 3 PID: 1421 Comm: brcmf_wdog/mmc0 Not tainted 4.17.0-rc5-next-20180517 #18 [ 1348.180757] Hardware name: Amarula A64-Relic (DT) [ 1348.185455] pstate: 60000005 (nZCv daif -PAN -UAO) [ 1348.190251] pc : brcmf_sdiod_freezer_count+0x0/0x20 [ 1348.195124] lr : brcmf_sdio_watchdog_thread+0x64/0x290 [ 1348.200253] sp : ffff00000b85be30 [ 1348.203561] x29: ffff00000b85be30 x28: 0000000000000000 [ 1348.208868] x27: ffff00000b6cb918 x26: ffff80003b990638 [ 1348.214176] x25: ffff0000087b1a20 x24: ffff80003b94f800 [ 1348.219483] x23: ffff000008e620c8 x22: ffff000008f0b660 [ 1348.224790] x21: ffff000008c6a858 x20: 00000000fffffe00 [ 1348.230097] x19: ffff80003b94f800 x18: 0000000000000001 [ 1348.235404] x17: 0000ffffab2e8a74 x16: ffff0000080d7de8 [ 1348.240711] x15: 0000000000000000 x14: 0000000000000400 [ 1348.246018] x13: 0000000000000400 x12: 0000000000000001 [ 1348.251324] x11: 00000000000002c4 x10: 0000000000000a10 [ 1348.256631] x9 : ffff00000b85bc40 x8 : ffff80003be11870 [ 1348.261937] x7 : ffff80003dfc7308 x6 : 000000078ff08b55 [ 1348.267243] x5 : 00000139e1058400 x4 : 0000000000000000 [ 1348.272550] x3 : dead000000000100 x2 : 958f2788d6618100 [ 1348.277856] x1 : 00000000fffffe00 x0 : 0000000000000000 Signed-off-by: Michael Trimarchi --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 412a05b..061f69d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4294,6 +4294,13 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus) brcmf_dbg(TRACE, "Enter\n"); if (bus) { + /* Stop watchdog task */ + if (bus->watchdog_tsk) { + send_sig(SIGTERM, bus->watchdog_tsk, 1); + kthread_stop(bus->watchdog_tsk); + bus->watchdog_tsk = NULL; + } + /* De-register interrupt handler */ brcmf_sdiod_intr_unregister(bus->sdiodev); -- 2.7.4