Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5558735imm; Wed, 12 Sep 2018 07:46:19 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbO09xbII6i5U4MmfKMKLIy6B0pKn02vUCAgPY0BDT0yqGOBxVJ4ZqRsmEyE04hrO72ti93 X-Received: by 2002:a63:7c50:: with SMTP id l16-v6mr2709788pgn.311.1536763579631; Wed, 12 Sep 2018 07:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536763579; cv=none; d=google.com; s=arc-20160816; b=Fhhi0iLtnJK6XviSlFYpTtz38+4ODd5vxe0UPW7hxDh86bxtj0MPFyrRGk9KQoy+Bu BtqtLV1DINltbrghCxXZq5R2lMD2taE4MJfF/sY/rpdLUP7h98Kq06n0CSvj4f3Nqe5e u/rWHbO3Y3rhNGdGFUmUV0acZoKH1fWOPjJQduBSAPu1e76kpeS+Mw+nK3pr+j+kC6b7 tH54dBC3PJ6U987Snj/VM2rgmvzfHG/mdtiz3AocglpB8SrqNtTWqTBaOdM1rbcbFS+g Px7w2FDxvrJG/Kv6aRyWvO7bSI6+q5h0aQPF82OC405yBOxSs85OA5yV+yEVuc2V8vu5 CcCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=x72lGhp/k4rUGeOhA5zT+Do2GXkfserVXvZ4yHF/W2I=; b=r/OxJiUxCc7U/X81zt58l7r44jp4gVeucw6vDdBZQ3etDBxDPsGCxhC6Yl4AWT3/qD C1tD23ouPeTiPLrjXgEpYaZ/Yi4zxFM9QWwlrZQBhVJNRTKFBtWDqPS46a4h+geC5KT0 W8W/jKLBhdqWG0nQi7xVlVValGIKLHe1sH4EKcYQNaIjN0A8XffsEd4qYKasTk1CN5mK Bj7CtsGVnZsRYUln1V9OLiqR2gZvuoiZ6vh756qBrjvwt+7B3J5hqVCu5mTSeJUtK9Ol iNc84auNTC6mdcqmMnNsykCukN+bdTq4KggtTE6DEABJyLrcVMX1vmZu5PPJiN55eMoH xO8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yWfBmncu; 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 f185-v6si1223262pgc.625.2018.09.12.07.46.00; Wed, 12 Sep 2018 07:46:19 -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=yWfBmncu; 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 S1728147AbeILTsW (ORCPT + 99 others); Wed, 12 Sep 2018 15:48:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:60446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbeILTsW (ORCPT ); Wed, 12 Sep 2018 15:48:22 -0400 Received: from localhost.localdomain (unknown [192.55.54.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DC7420890; Wed, 12 Sep 2018 14:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536763413; bh=QhFHXF8dJGKnbYhMTMXvdCE6dwgbyIqjiV0Bek7Ob1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWfBmncuMLqFsza8fElpeokdccB2ltPGrTfeXznh2Pv2qUL8oGbBTI7jTpy0eboay Bw3yAaHimJP+LM+e1s98KFcuoyWI9l6B4nDVrsnuNRs8vVutFUJ8FFvTnkwHHd5YWS nQogonRR5gwC6k8SWcyTFWnwiwkUBBwea/TgkOH8= From: Alan Tull To: Greg Kroah-Hartman Cc: Moritz Fischer , Alan Tull , linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org Subject: [PATCH 1/5] fpga: do not access region struct after fpga_region_unregister Date: Wed, 12 Sep 2018 09:43:23 -0500 Message-Id: <20180912144327.3130-2-atull@kernel.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180912144327.3130-1-atull@kernel.org> References: <20180912144327.3130-1-atull@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A couple drivers were accessing the region struct after it had been freed. Save off the pointer to the mgr before the region struct gets freed. Signed-off-by: Alan Tull Acked-by: Moritz Fischer --- drivers/fpga/dfl-fme-region.c | 4 +++- drivers/fpga/of-fpga-region.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/fpga/dfl-fme-region.c b/drivers/fpga/dfl-fme-region.c index 0b7e19c..51a5ac2 100644 --- a/drivers/fpga/dfl-fme-region.c +++ b/drivers/fpga/dfl-fme-region.c @@ -14,6 +14,7 @@ */ #include +#include #include #include "dfl-fme-pr.h" @@ -66,9 +67,10 @@ static int fme_region_probe(struct platform_device *pdev) static int fme_region_remove(struct platform_device *pdev) { struct fpga_region *region = dev_get_drvdata(&pdev->dev); + struct fpga_manager *mgr = region->mgr; fpga_region_unregister(region); - fpga_mgr_put(region->mgr); + fpga_mgr_put(mgr); return 0; } diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c index 35fabb8..052a134 100644 --- a/drivers/fpga/of-fpga-region.c +++ b/drivers/fpga/of-fpga-region.c @@ -437,9 +437,10 @@ static int of_fpga_region_probe(struct platform_device *pdev) static int of_fpga_region_remove(struct platform_device *pdev) { struct fpga_region *region = platform_get_drvdata(pdev); + struct fpga_manager *mgr = region->mgr; fpga_region_unregister(region); - fpga_mgr_put(region->mgr); + fpga_mgr_put(mgr); return 0; } -- 2.7.4