Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp885094yba; Thu, 18 Apr 2019 11:11:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7eA52sIOvVvcamLBe+u+f49cdRhEzIzdpwj/epi0c8jNP7v/p+r8ZbihFsqVJL0PYrgZY X-Received: by 2002:a63:100e:: with SMTP id f14mr56053090pgl.192.1555611076905; Thu, 18 Apr 2019 11:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611076; cv=none; d=google.com; s=arc-20160816; b=R1653kMtLLeUffpo7GUR4nQvgjFfGYq+IFlt5GdMW2Tf/4Zi9QWEO9bDKafZL+I6iK k6+htv9gWODj0t0d2KyT36N3yIJHLm1e/3fzifZBjcWWRd6cZ1L36AciyVlfuFMfiOdS RP2MRR9b4Ek48mMTy2HEc+Sfhonl7LFiBGJTj4fTWpz0psH02iP3kmm6dYKEnjYVTCy9 lMH3g/RG9RBFoBnkafmirvTCaHxwkuGQ7eDiRvqUx+UsRdJ9RaUIpG+M0TkXE7m8X6rj QaZmM0bcinOZgDxD+NdEzDoNmD6aimpYcMNeMA/ZbLEAj9s0o+hmSaqAeClckGjvmCwu bb/w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0Ny1MZY7ziCLZ9zqQinLTOn2ayaYuXN3gNP1w8bBVRQ=; b=aRShtvDrFDGWQYj9Be7uHO8EvlEsRi7fWE3Ti3djcOqfohs7n23q2HxWfc7vDWW4hA jdZrl96y2POjq07zG69THiPUhuGIMC3w5BMaptFHO9hvnbzD5yxp1S9xCSllMBT0npnD uTwmehuW9PuwLu1sXX0PQwmasyElydSP5KfEUC3Jia0E/Gk1U9h7raj5Ik4t/b1MPpRs Iqqbe2FFe6qA/Ygk2VXUiKa7HjZMnFbhJeOVI0hVVbO/YBxldFvtK5B1i9N/vItdqiHh nOFYwU2BWhOtEh+10GnEIUuWr4QgEOj6RyjGME1b6R0kQ12x16/PrAajIoXJC3BXprNB 96Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Jp2yT/H2"; 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 m63si2812765pld.147.2019.04.18.11.11.01; Thu, 18 Apr 2019 11:11:16 -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="Jp2yT/H2"; 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 S2403898AbfDRSJW (ORCPT + 99 others); Thu, 18 Apr 2019 14:09:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:40892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391875AbfDRSJT (ORCPT ); Thu, 18 Apr 2019 14:09:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 80F4D2186A; Thu, 18 Apr 2019 18:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610959; bh=lI9kc5cDms9hJ8BTMoC0tjOimcd+Pi92HoaaDLv/DMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jp2yT/H24IY0G5fm1wJIDU9F62T2y6Cd9bhM3KEkLC2iO3jNQUXcIQwelhUBmlsK7 0DQ4Fa01VwcaGN7ygSVMniKNfoGpGDaNKo8Z71oetZ8b38yFAQRY+s4WCE4krKExO7 TNYJdHOCj7lyMh8V7mFn0xwBXzBGZNiw22HCziqo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Siva Rebbagondla , Kalle Valo , Sasha Levin Subject: [PATCH 4.9 29/50] rsi: improve kernel thread handling to fix kernel panic Date: Thu, 18 Apr 2019 19:57:40 +0200 Message-Id: <20190418160426.368110507@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 d3fbe33d2324..a13f08fd8690 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