From patchwork Mon Oct 28 11:36:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bgottumukkala@emulex.com X-Patchwork-Id: 3101631 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F9BABF924 for ; Mon, 28 Oct 2013 11:24:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 356C92020A for ; Mon, 28 Oct 2013 11:24:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C75C201CE for ; Mon, 28 Oct 2013 11:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756119Ab3J1LY0 (ORCPT ); Mon, 28 Oct 2013 07:24:26 -0400 Received: from cmexedge1.ext.emulex.com ([138.239.224.99]:13473 "EHLO CMEXEDGE1.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756109Ab3J1LYZ (ORCPT ); Mon, 28 Oct 2013 07:24:25 -0400 Received: from CMEXHTCAS2.ad.emulex.com (138.239.115.218) by CMEXEDGE1.ext.emulex.com (138.239.224.99) with Microsoft SMTP Server (TLS) id 14.3.146.0; Mon, 28 Oct 2013 04:24:40 -0700 Received: from RoCE-SLESS-DUT.site (10.192.238.42) by smtp.emulex.com (138.239.115.208) with Microsoft SMTP Server id 14.3.146.2; Mon, 28 Oct 2013 04:24:22 -0700 From: To: CC: , Naresh Gottumukkala Subject: [PATCH] RDMA/ocrdma: Fix the driver crash during rmmod. Date: Mon, 28 Oct 2013 17:06:25 +0530 X-Mailer: git-send-email 1.8.2.3 MIME-Version: 1.0 Message-ID: <88bfa9eb-4579-4394-a2ae-8ea6370c55ce@CMEXHTCAS2.ad.emulex.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Naresh Gottumukkala ocrdma_remove_free funtion can be called in a bottom-half context. So the code in this funtion should not sleep. Moved the resource cleanup code to ocrdma_remove instead of ocrdma_remove_free. Signed-off-by: Naresh Gottumukkala --- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 0ce7674..91443bc 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c @@ -452,9 +452,6 @@ static void ocrdma_remove_free(struct rcu_head *rcu) { struct ocrdma_dev *dev = container_of(rcu, struct ocrdma_dev, rcu); - ocrdma_free_resources(dev); - ocrdma_cleanup_hw(dev); - idr_remove(&ocrdma_dev_id, dev->id); kfree(dev->mbx_cmd); ib_dealloc_device(&dev->ibdev); @@ -470,6 +467,10 @@ static void ocrdma_remove(struct ocrdma_dev *dev) spin_lock(&ocrdma_devlist_lock); list_del_rcu(&dev->entry); spin_unlock(&ocrdma_devlist_lock); + + ocrdma_free_resources(dev); + ocrdma_cleanup_hw(dev); + call_rcu(&dev->rcu, ocrdma_remove_free); }