Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2085962ybb; Fri, 29 Mar 2019 18:42:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqz83JtknKwPzf1cXWRXar+lWHHUxmQSoXhERgH1+736b66U1Ifbb2cA5CZgcY44M3CxSc7t X-Received: by 2002:a63:4e64:: with SMTP id o36mr47539868pgl.213.1553910141260; Fri, 29 Mar 2019 18:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553910141; cv=none; d=google.com; s=arc-20160816; b=XcZxMPbbiQvUNAfrcGCgc8LonUEgrqxn03ITOsxmViS8J/64NCqdmUaAGAsAK/RoHA MWb6ZFzAUYW6/teKBid+I9Tqk7MZkXn6YpISmZFLKGU3ab2YzVnWTtvqmqiSbe/O52nc pudbdaHhs80XYVzN7VBb/FfeqtchO/ZSDXkf7KESzMWldz8MXJALlV/r1lYpZIkMoFt4 DnbVXcIyGDl9PsOYiny2wxxSfadUKZm6JJzJx5CoM6p0+8I0tumKS9yJiohNzkFgrEnF Cmg9BPuEL/BnRwdW3RoLK7C0hVbpig2eCM6N/8W1SRLXPcalXbD95mh6f5mc0HrzJgDs Hclw== 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=6Mk1mHF9SagivQlCyvfEBIemcZRxnnU1mOHejFQVKDw=; b=H4B8W/RGduFJJbTRDnseQeg3aPJf7BQJFbdLc28r0QNPMER2sBUG8mnD5y1brtQWdp nLvXj7ag3WRyBkHUsoqJVN21daZnnUkkt08nfUm66E2YpWB5Eg3dDHgR1D2RxIxVF8cS 6C/4zqr1uLa8RGB/vWPmfz1zHle6kaDAQrFaaGtGZMDLCiAJDQvYHUXIwt07/TkbjGjf +w/oV7iCGMIKEWQVjDtgMOYpiVVsMUkasIEmsHhCTauPbFU7tYE/K/xceW1yyNQUtVi4 TPPTN+/V2mRlSDeBeRLlfLx06cZPP4Ezd026rGNSZbtO1rLUYhgloKh/biLDBPPow1+W KG7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EeoMkCkk; 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 h73si3217057pfj.220.2019.03.29.18.42.06; Fri, 29 Mar 2019 18:42:21 -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=EeoMkCkk; 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 S1731632AbfC3BlW (ORCPT + 99 others); Fri, 29 Mar 2019 21:41:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:35690 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730664AbfC3B27 (ORCPT ); Fri, 29 Mar 2019 21:28:59 -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 7BCC5218A6; Sat, 30 Mar 2019 01:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553909338; bh=7Hqa+hd3SjcWJChOGFb42MMRW0TR0vlPtBDXq6GjTGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EeoMkCkkrhlbCA7CUSP/Tkg2U9ZpFRABR1HhkD83IQeKnKz+kBrT4OihjN3At6v0r WgxNpkIbdKfFMgCs5CD4ZE0o8xxLHs8vaCoxQWZ/yvXVGCFUpdj/Wsy1/34JkSEg+v izLE5m/jA/ErUFnW1TLFRVnS9hELE0V7kETKWBW8= 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.19 03/57] rsi: improve kernel thread handling to fix kernel panic Date: Fri, 29 Mar 2019 21:27:56 -0400 Message-Id: <20190330012854.32212-3-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190330012854.32212-1-sashal@kernel.org> References: <20190330012854.32212-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 d9ff3b8be86e..60f1f286b030 100644 --- a/drivers/net/wireless/rsi/rsi_common.h +++ b/drivers/net/wireless/rsi/rsi_common.h @@ -75,7 +75,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