Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2084124ybb; Fri, 29 Mar 2019 18:38:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqybiszxG3V7mh8wvIrx3aC2rmBeE7hEQclOvixY//V/nQaZyTSEubLaOjTCGIaU67pcDDoN X-Received: by 2002:aa7:90c7:: with SMTP id k7mr49756379pfk.186.1553909925105; Fri, 29 Mar 2019 18:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553909925; cv=none; d=google.com; s=arc-20160816; b=Ia/kNrMebDHBRJAG1MEdANtvw1h8GnmQxi4H+VsEPSgAcT4wCaslnPoeTXwdtETk1i O0hDCTX8KhK8Dx4PHYLTxN8JH0JssFg4SKceLeXHmxOpuoYPXxg0IWlua1w16iYTxDQ8 MtSMTEYbwiP7o1/slFHJ1TI5i/HC9vZT35oEmydDEgDPyAYuWRe9EojIy8QJQmGT2msZ O1xHTkgQ/eei68WKjDuja4UvEpQMM2lf7cnNwOnTFyE4nTMD2paXxzdoghlCiIFoJP/t 6ylTZrlXOjuWTNQPv4V6Ie58ldlgOEyjUjPgVZBXwBcoSdO/zMFIBUzxOuTu2S/o+EYp 6OhQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2u0EufKU69cUZmPVHIuAho62WXxIn31z2kGrzeZD32A=; b=iASyOMFIzKzetK7f2gPCjmMG6Fa1W/oG19kEpmZ6wh3vvo87RykqRni/5paqm+vLLO 1tuPymyPrvzJogRyN4pNEWsUIOtAL7V4ejmfAqFT6PReBzjjZrn9oywxXanaLWDNJ8jb gjKd4uJax1Y6vvwKU/jVnOAPXZ5SPNsAGNkCvUPXhXVwevgFpaikMmI48LbMOibhmbcx 2yrWfLjYdLr971HcYi52VePyZkZmoCG+PsHTkbkzVdhPaNlYr7/xo2AA8sbeAWeSfN9T 4kEXQCUEJ/S1BaEEbLtoEZ5Ed1H46R6O7wcIxzS8Va5y2SOU+FxQZbYH6+GAUItI5Gme 4BsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zJcTOite; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10si3221083pfj.132.2019.03.29.18.38.30; Fri, 29 Mar 2019 18:38:45 -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=@kernel.org header.s=default header.b=zJcTOite; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731584AbfC3Ba1 (ORCPT + 99 others); Fri, 29 Mar 2019 21:30:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:37612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731490AbfC3BaY (ORCPT ); Fri, 29 Mar 2019 21:30:24 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 94A87217F5; Sat, 30 Mar 2019 01:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553909423; bh=rQLJv/2SMiTvz2Vug3f0dOGP2fNBIcvrrnTFXWR93uw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zJcTOitem/96LcGS+kJyQKKcb5UgAN9oT3FolEsQxW6gzmbdcPp2GyDxt8UMfmNjC 3odN2Pw8YDzTTL8J3Y1diJJQJUq5lLHj2LBTFRV76ZIFUoZEtAI6Yp1MN8wRfdkTSG XcmLfMBbILgm5wOoZFFk86UPs0pdflL34IFKTkIs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Siva Rebbagondla , Kalle Valo , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 02/37] rsi: improve kernel thread handling to fix kernel panic Date: Fri, 29 Mar 2019 21:29:45 -0400 Message-Id: <20190330013020.379-2-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190330013020.379-1-sashal@kernel.org> References: <20190330013020.379-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Siva Rebbagondla [ Upstream commit 4c62764d0fc21a34ffc44eec1210038c3a2e4473 ] While running regressions, observed below kernel panic when sdio disconnect called. This is because of, kthread_stop() is taking care of wait_for_completion() by default. When wait_for_completion triggered in kthread_stop and as it was done already, giving kernel panic. Hence, removing redundant wait_for_completion() from rsi_kill_thread(). ... skipping ... BUG: unable to handle kernel NULL pointer dereference at (null) IP: [] exit_creds+0x1f/0x50 PGD 0 Oops: 0002 [#1] SMP CPU: 0 PID: 6502 Comm: rmmod Tainted: G OE 4.15.9-Generic #154-Ubuntu Hardware name: Dell Inc. Edge Gateway 3003/ , BIOS 01.00.00 04/17/2017 Stack: ffff88007392e600 ffff880075847dc0 ffffffff8108160a 0000000000000000 ffff88007392e600 ffff880075847de8 ffffffff810a484b ffff880076127000 ffff88003cd3a800 ffff880074f12a00 ffff880075847e28 ffffffffc09bed15 Call Trace: [] __put_task_struct+0x5a/0x140 [] kthread_stop+0x10b/0x110 [] rsi_disconnect+0x2f5/0x300 [ven_rsi_sdio] [] ? __pm_runtime_resume+0x5b/0x80 [] sdio_bus_remove+0x38/0x100 [] __device_release_driver+0xa4/0x150 [] driver_detach+0xb5/0xc0 [] bus_remove_driver+0x55/0xd0 [] driver_unregister+0x2c/0x50 [] sdio_unregister_driver+0x1a/0x20 [] rsi_module_exit+0x15/0x30 [ven_rsi_sdio] [] SyS_delete_module+0x1b8/0x210 [] entry_SYSCALL_64_fastpath+0x1c/0xbb Signed-off-by: Siva Rebbagondla Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/rsi/rsi_common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireless/rsi/rsi_common.h b/drivers/net/wireless/rsi/rsi_common.h index e579d694d13c..21986ba56a3c 100644 --- a/drivers/net/wireless/rsi/rsi_common.h +++ b/drivers/net/wireless/rsi/rsi_common.h @@ -74,7 +74,6 @@ static inline int rsi_kill_thread(struct rsi_thread *handle) atomic_inc(&handle->thread_done); rsi_set_event(&handle->event); - wait_for_completion(&handle->completion); return kthread_stop(handle->task); } -- 2.19.1