From patchwork Tue Mar 20 13:40:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 10297201 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E94F602C2 for ; Tue, 20 Mar 2018 13:53:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E821292DE for ; Tue, 20 Mar 2018 13:53:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22D03295CE; Tue, 20 Mar 2018 13:53:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95BBE292DE for ; Tue, 20 Mar 2018 13:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753610AbeCTNxC (ORCPT ); Tue, 20 Mar 2018 09:53:02 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:43561 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753098AbeCTNxB (ORCPT ); Tue, 20 Mar 2018 09:53:01 -0400 Received: by mail-pg0-f65.google.com with SMTP id i9so631200pgq.10 for ; Tue, 20 Mar 2018 06:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=kDG5dxbcotaTF/2DYOjk6ISyaT4AB83zI9TfeVjMzN8=; b=piV0g1PeFh3Hf+1B7/zj5CZ9Ekzl6mNKGqxbyeK4lyzdfbO214QqRsI5D/q4rhPF/r kBXsWLyMEy6kjpwA/UWU833VCovBKkp6cK0uxt5+VaNPVVzXI3simjIT9jOJp3+FK1Fn ZObTDoOe6o0KFJrzJuG0zbn0U3TYtVWayqI6e/hEWUtv9Sw3oHnrCaYyxKWITTTOGkEZ ml8VsALM5WDvs2J3eBueexA7L1KWs9fS6xG5NA1TVqSemGBqaSzZfEJOm/kYM6nvviI7 eCG1V22o/kHwlrkbTru0gPDm4Aj9Knr3MbcO7FVJFGWu/pRLHI3EDb/P3PXibY+oWpv+ ozQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kDG5dxbcotaTF/2DYOjk6ISyaT4AB83zI9TfeVjMzN8=; b=sEqnJP6Q9CAtkHnp1oueMcs+8XBQgk+r/Vlebup62vvtNShMl0DJk5Bj2fuHJl8SsY C1d+MBYxubW3nV6HL44bWGfgsos8OqSepouPXS4OX3hP9UZTIuOdXFq2o837QMW8BpDf jPneLt2hQcoeWorPJdX5qySS7kFcxjb1hG/9t5Fvi1ToH1o2XTFiE/5z2kQ8X60HjzPl 7scuVxVUZkqXmc6oqUaycTmlA9kh4z8E1uLQrGUFnxYdzdvHXNEIzwm6RxvsjS72zehM l4GM9cWvnZCp4zhtaX/FWTeQBtzFrPF73wGIXmbQ71jNRO2eqO5qkdouUm+e/IzOX7HD UtSA== X-Gm-Message-State: AElRT7HyKkwxK92/GjHTOFtXeCY//2/4C8brXRP+sKBK63Qt9EHUtR7+ ELWoGAh15ZzyLxrERQ1Zs3JQ8w== X-Google-Smtp-Source: AG47ELvwGSVwTqa9bwiv8e51ckg9dcJvE+RFQ0Nzn/bmmdGPsl8f5rHmHp0UhxLw3AziUop6ABrt+w== X-Received: by 10.98.75.129 with SMTP id d1mr13770994pfj.19.1521553980232; Tue, 20 Mar 2018 06:53:00 -0700 (PDT) Received: from cpu185.redpinesignals.com ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id x128sm3666881pgb.31.2018.03.20.06.52.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Mar 2018 06:52:59 -0700 (PDT) From: Amitkumar Karwar To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Amitkumar Karwar , Siva Rebbagondla Subject: [PATCH 1/2] rsi: fix error path handling in SDIO probe Date: Tue, 20 Mar 2018 19:10:40 +0530 Message-Id: <1521553241-12676-1-git-send-email-amitkarwar@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Amitkumar Karwar We miss to release IRQ in certain error path in SDIO probe which causes following kernel panic. This patch corrects error path handling BUG: unable to handle kernel NULL pointer dereference at (null) IP: (null) PGD 0 P4D 0 Oops: 0010 [#1] SMP PTI Call Trace: ? call_timer_fn+0x29/0x120 ? run_timer_softirq+0x1da/0x420 ? timer_interrupt+0x11/0x20 ? __do_softirq+0xef/0x26e ? irq_exit+0xbe/0xd0 ? do_IRQ+0x4a/0xc0 ? common_interrupt+0xa2/0xa2 ? cpuidle_enter_state+0x118/0x250 ? do_idle+0x186/0x1e0 ? cpu_startup_entry+0x6f/0x80 ? start_kernel+0x47c/0x49c ? secondary_startup_64+0xa5/0xb0 Fixes: 50117605770c ("rsi: improve RX handling in SDIO interface") Signed-off-by: Amitkumar Karwar --- drivers/net/wireless/rsi/rsi_91x_sdio.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c index 13705fc..9ce2edb 100644 --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c @@ -967,7 +967,7 @@ static int rsi_probe(struct sdio_func *pfunction, rsi_sdio_rx_thread, "SDIO-RX-Thread"); if (status) { rsi_dbg(ERR_ZONE, "%s: Unable to init rx thrd\n", __func__); - goto fail_free_adapter; + goto fail_kill_thread; } skb_queue_head_init(&sdev->rx_q.head); sdev->rx_q.num_rx_pkts = 0; @@ -977,7 +977,7 @@ static int rsi_probe(struct sdio_func *pfunction, rsi_dbg(ERR_ZONE, "%s: Failed to request IRQ\n", __func__); sdio_release_host(pfunction); status = -EIO; - goto fail_kill_thread; + goto fail_claim_irq; } sdio_release_host(pfunction); rsi_dbg(INIT_ZONE, "%s: Registered Interrupt handler\n", __func__); @@ -985,7 +985,7 @@ static int rsi_probe(struct sdio_func *pfunction, if (rsi_hal_device_init(adapter)) { rsi_dbg(ERR_ZONE, "%s: Failed in device init\n", __func__); status = -EINVAL; - goto fail_kill_thread; + goto fail_dev_init; } rsi_dbg(INFO_ZONE, "===> RSI Device Init Done <===\n"); @@ -1002,10 +1002,13 @@ static int rsi_probe(struct sdio_func *pfunction, fail_dev_init: sdio_claim_host(pfunction); sdio_release_irq(pfunction); - sdio_disable_func(pfunction); sdio_release_host(pfunction); -fail_kill_thread: +fail_claim_irq: rsi_kill_thread(&sdev->rx_thread); +fail_kill_thread: + sdio_claim_host(pfunction); + sdio_disable_func(pfunction); + sdio_release_host(pfunction); fail_free_adapter: rsi_91x_deinit(adapter); rsi_dbg(ERR_ZONE, "%s: Failed in probe...Exiting\n", __func__);