Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4907944ooa; Tue, 14 Aug 2018 12:18:30 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwZvNZEBMdQWkSz6Qjjy5uJigJm64jvyfexjqF/jeSZd79wxA0enbYgFf+GRip73HbrBgbX X-Received: by 2002:a62:384:: with SMTP id 126-v6mr24418349pfd.11.1534274310641; Tue, 14 Aug 2018 12:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534274310; cv=none; d=google.com; s=arc-20160816; b=UEDiyZndTjgj+HOaC4b1UjfKt7ulpDCqC5euUYEtPLwub38OT9FK2xi5Ky3qxpZ/vf 2OJ0VDj2DOCBXosurVGcsGtadSrGzAxvAarCSIzVCEpFN/q7NTIkE4yu9l7O5mYx2GYW Krk2MV3SkBw6d2AHQ7t9+kVdaa5luo7Jo27wTE5n41kfe2Sn2FNcS1Tpx1rfDX6AHCHT B3D+ArhzzhWnrlu5om6kVOeHEAtq9zoew798/vM0me8foUSVwQgh+zwXEmhSYawlOa0Z QUJFRkH+cy4DbCKxq9u0K3HyDyvMHWguDhp/bI1Hy06LxW6F6ML4cqKa+mLPpNZkWAMR elFw== 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:arc-authentication-results; bh=s+87BBz14m4WO5U6KbmdRdnVHgci6w/+XTi2HnNgWEo=; b=r1xRnxevE++OofokRYn+EFMDA7qNJa5l0PY6R0rPkVFZ1p+MolqEmY8mKMIfdTOa7j kmyd/5zmQRiIh53gaEQQkj0qkv/fMdOBCCLcFldcQsXOCNWdSDqEMGTQvcv/Ca/M+VPr BAKurMHmjbOnTWNdJypIJbQrFHWHlEcjvE3uiC8Ius0NawpAeMw3wPWPusM0g2KUkY4a n7x/yhsu6gxHSpouqr51A1KNacjN4RyE8RIrL2h+uzPi1NRwqlN3fwdoVpuGN+94bOMo 1UX/drEYnIO0WhevealhkeOoN4pGY9Da8+qV5BTZP14xWVQNE297zKMjupv8rzCetRJX b06w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="xM/q55Eb"; 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 68-v6si22483694pff.55.2018.08.14.12.18.15; Tue, 14 Aug 2018 12:18:30 -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="xM/q55Eb"; 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 S1729336AbeHNWEL (ORCPT + 99 others); Tue, 14 Aug 2018 18:04:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:50532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727755AbeHNWEK (ORCPT ); Tue, 14 Aug 2018 18:04:10 -0400 Received: from localhost.localdomain (unknown [192.55.54.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F99B21730; Tue, 14 Aug 2018 19:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1534274133; bh=tSIThTYbZnRemqIn95vslDmNT8FfJXCfvgYARXHkF48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xM/q55Eb1k3IK9tk26je71qux81ivf9BvqTMNAv8654Dudeo/phpbHjt5qnSZ8JzE HJU2wk/UnVoULbop7g/4OFZ4aqAe4r+fDApc3JmPxE0AJprCyjm1cUuImZc0DbDO8g DsA4w+w1VQy7OkajG14KXUPiBY7481JgO8vonrp4= From: Alan Tull To: Moritz Fischer , Jonathan Corbet Cc: Randy Dunlap , linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org, linux-doc@vger.kernel.org, Alan Tull Subject: [PATCH 1/8] fpga: do not access region struct after fpga_region_unregister Date: Tue, 14 Aug 2018 14:15:19 -0500 Message-Id: <20180814191526.3247-2-atull@kernel.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180814191526.3247-1-atull@kernel.org> References: <20180814191526.3247-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 --- 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