From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Remi Pommarel <repk@triplefau.lt>,
Elie Roudninski <xademax@gmail.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Kevin Hilman <khilman@baylibre.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Sasha Levin <sashal@kernel.org>,
linux-iio@vger.kernel.org, linux-amlogic@lists.infradead.org
Subject: [PATCH AUTOSEL 4.14 19/56] iio: adc: meson_saradc: Fix memory allocation order
Date: Fri, 18 Oct 2019 18:07:16 -0400 [thread overview]
Message-ID: <20191018220753.10002-19-sashal@kernel.org> (raw)
In-Reply-To: <20191018220753.10002-1-sashal@kernel.org>
From: Remi Pommarel <repk@triplefau.lt>
[ Upstream commit de10ac47597e7a3596b27631d0d5ce5f48d2c099 ]
meson_saradc's irq handler uses priv->regmap so make sure that it is
allocated before the irq get enabled.
This also fixes crash when CONFIG_DEBUG_SHIRQ is enabled, as device
managed resources are freed in the inverted order they had been
allocated, priv->regmap was freed before the spurious fake irq that
CONFIG_DEBUG_SHIRQ adds called the handler.
Fixes: 3af109131b7eb8 ("iio: adc: meson-saradc: switch from polling to interrupt mode")
Reported-by: Elie Roudninski <xademax@gmail.com>
Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: Elie ROUDNINSKI <xademax@gmail.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/adc/meson_saradc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 2515badf8b280..9b2121f249263 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -976,6 +976,11 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
if (IS_ERR(base))
return PTR_ERR(base);
+ priv->regmap = devm_regmap_init_mmio(&pdev->dev, base,
+ priv->data->regmap_config);
+ if (IS_ERR(priv->regmap))
+ return PTR_ERR(priv->regmap);
+
irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
if (!irq)
return -EINVAL;
@@ -985,11 +990,6 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
if (ret)
return ret;
- priv->regmap = devm_regmap_init_mmio(&pdev->dev, base,
- priv->data->regmap_config);
- if (IS_ERR(priv->regmap))
- return PTR_ERR(priv->regmap);
-
priv->clkin = devm_clk_get(&pdev->dev, "clkin");
if (IS_ERR(priv->clkin)) {
dev_err(&pdev->dev, "failed to get clkin\n");
--
2.20.1
next prev parent reply other threads:[~2019-10-18 22:16 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 22:06 [PATCH AUTOSEL 4.14 01/56] f2fs: flush quota blocks after turnning it off Sasha Levin
2019-10-18 22:06 ` [PATCH AUTOSEL 4.14 02/56] scsi: lpfc: Fix a duplicate 0711 log message number Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 03/56] sc16is7xx: Fix for "Unexpected interrupt: 8" Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 04/56] powerpc/powernv: hold device_hotplug_lock when calling memtrace_offline_pages() Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 05/56] HID: i2c-hid: add Direkt-Tek DTLAPY133-1 to descriptor override Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 06/56] x86/cpu: Add Atom Tremont (Jacobsville) Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 07/56] HID: i2c-hid: Add Odys Winbook 13 to descriptor override Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 08/56] clk: boston: unregister clks on failure in clk_boston_setup() Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 09/56] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 10/56] HID: Add ASUS T100CHI keyboard dock battery quirks Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 11/56] usb: handle warm-reset port requests on hub resume Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 12/56] rtc: pcf8523: set xtal load capacitance from DT Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 13/56] mlxsw: spectrum: Set LAG port collector only when active Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 14/56] ALSA: hda/realtek - Apply ALC294 hp init also for S4 resume Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 15/56] media: vimc: Remove unused but set variables Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 16/56] exec: load_script: Do not exec truncated interpreter path Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 17/56] PCI/PME: Fix possible use-after-free on remove Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 18/56] power: supply: max14656: fix potential use-after-free Sasha Levin
2019-10-18 22:07 ` Sasha Levin [this message]
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 20/56] iio: fix center temperature of bmc150-accel-core Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 21/56] libsubcmd: Make _FORTIFY_SOURCE defines dependent on the feature Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 22/56] perf tests: Avoid raising SEGV using an obvious NULL dereference Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 23/56] perf map: Fix overlapped map handling Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 24/56] perf jevents: Fix period for Intel fixed counters Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 25/56] staging: rtl8188eu: fix null dereference when kzalloc fails Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 26/56] crypto: arm/aes-ce - add dependency on AES library Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 27/56] RDMA/hfi1: Prevent memory leak in sdma_init Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 28/56] RDMA/iwcm: Fix a lock inversion issue Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 29/56] HID: hyperv: Use in-place iterator API in the channel callback Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 30/56] nfs: Fix nfsi->nrequests count error on nfs_inode_remove_request Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 31/56] arm64: ftrace: Ensure synchronisation in PLT setup for Neoverse-N1 #1542419 Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 32/56] tty: serial: owl: Fix the link time qualifier of 'owl_uart_exit()' Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 33/56] tty: n_hdlc: fix build on SPARC Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 34/56] gpio: max77620: Use correct unit for debounce times Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 35/56] fs: cifs: mute -Wunused-const-variable message Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 36/56] serial: mctrl_gpio: Check for NULL pointer Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 37/56] efi/cper: Fix endianness of PCIe class code Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 38/56] efi/x86: Do not clean dummy variable in kexec path Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 39/56] kbuild: fix build error of 'make nsdeps' in clean tree Sasha Levin
2019-10-19 0:13 ` Masahiro Yamada
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 40/56] MIPS: include: Mark __cmpxchg as __always_inline Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 41/56] x86/xen: Return from panic notifier Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 42/56] ocfs2: clear zero in unaligned direct IO Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 43/56] fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry() Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 44/56] fs: ocfs2: fix a possible null-pointer dereference in ocfs2_write_end_nolock() Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 45/56] fs: ocfs2: fix a possible null-pointer dereference in ocfs2_info_scan_inode_alloc() Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 46/56] sched/vtime: Fix guest/system mis-accounting on task switch Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 47/56] perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 48/56] iio: adc: ad799x: fix probe error handling Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 49/56] iio: light: opt3001: fix mutex unlock race Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 50/56] MIPS: include: Mark __xchg as __always_inline Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 51/56] MIPS: fw: sni: Fix out of bounds init of o32 stack Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 52/56] USB: usb-skeleton: fix use-after-free after driver unbind Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 53/56] nbd: fix possible sysfs duplicate warning Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 54/56] NFSv4: Fix leak of clp->cl_acceptor string Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 55/56] s390/uaccess: avoid (false positive) compiler warnings Sasha Levin
2019-10-18 22:07 ` [PATCH AUTOSEL 4.14 56/56] tracing: Initialize iter->seq after zeroing in tracing_read_pipe() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191018220753.10002-19-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=repk@triplefau.lt \
--cc=stable@vger.kernel.org \
--cc=xademax@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).