linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Miquel Raynal <miquel.raynal@bootlin.com>
Subject: [PATCH 4.14 092/125] mtd: rawnand: oxnas: Unregister all devices on error
Date: Mon, 20 Jul 2020 17:37:11 +0200	[thread overview]
Message-ID: <20200720152807.464303992@linuxfoundation.org> (raw)
In-Reply-To: <20200720152802.929969555@linuxfoundation.org>

From: Miquel Raynal <miquel.raynal@bootlin.com>

commit b60391eb17b2956ff2fc4c348e5a464da21ff9cb upstream.

On error, the oxnas probe path just frees the device which failed and
aborts the probe, leaving unreleased resources.

Fix this situation by calling mtd_device_unregister()/nand_cleanup()
on these.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-38-miquel.raynal@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/nand/oxnas_nand.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/drivers/mtd/nand/oxnas_nand.c
+++ b/drivers/mtd/nand/oxnas_nand.c
@@ -89,6 +89,7 @@ static int oxnas_nand_probe(struct platf
 	struct resource *res;
 	int count = 0;
 	int err = 0;
+	int i;
 
 	/* Allocate memory for the device structure (and zero it) */
 	oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
@@ -168,6 +169,13 @@ err_cleanup_nand:
 	nand_cleanup(chip);
 err_release_child:
 	of_node_put(nand_np);
+
+	for (i = 0; i < oxnas->nchips; i++) {
+		chip = oxnas->chips[i];
+		WARN_ON(mtd_device_unregister(nand_to_mtd(chip)));
+		nand_cleanup(chip);
+	}
+
 err_clk_unprepare:
 	clk_disable_unprepare(oxnas->clk);
 	return err;



  parent reply	other threads:[~2020-07-20 15:49 UTC|newest]

Thread overview: 130+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 15:35 [PATCH 4.14 000/125] 4.14.189-rc1 review Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 001/125] KVM: s390: reduce number of IO pins to 1 Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 002/125] spi: spi-fsl-dspi: Adding shutdown hook Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 003/125] spi: spi-fsl-dspi: Fix lockup if device is removed during SPI transfer Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 004/125] spi: spi-fsl-dspi: use IRQF_SHARED mode to request IRQ Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 005/125] spi: spi-fsl-dspi: Fix external abort on interrupt in resume or exit paths Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 006/125] ARM: dts: omap4-droid4: Fix spi configuration and increase rate Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 007/125] gpu: host1x: Detach driver on unregister Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 008/125] spi: spidev: fix a race between spidev_release and spidev_remove Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 009/125] spi: spidev: fix a potential use-after-free in spidev_release() Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 010/125] ixgbe: protect ring accesses with READ- and WRITE_ONCE Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 011/125] s390/kasan: fix early pgm check handler execution Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 012/125] cifs: update ctime and mtime during truncate Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 013/125] ARM: imx6: add missing put_device() call in imx6q_suspend_init() Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 014/125] scsi: mptscsih: Fix read sense data size Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 015/125] nvme-rdma: assign completion vector correctly Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 016/125] x86/entry: Increase entry_stack size to a full page Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 017/125] net: cxgb4: fix return error value in t4_prep_fw Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 018/125] smsc95xx: check return value of smsc95xx_reset Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 019/125] smsc95xx: avoid memory leak in smsc95xx_bind Greg Kroah-Hartman
2020-07-20 15:35 ` [PATCH 4.14 020/125] ALSA: compress: fix partial_drain completion state Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 021/125] arm64: kgdb: Fix single-step exception handling oops Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 022/125] nbd: Fix memory leak in nbd_add_socket Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 023/125] bnxt_en: fix NULL dereference in case SR-IOV configuration fails Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 024/125] net: macb: mark device wake capable when "magic-packet" property present Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 025/125] mlxsw: spectrum_router: Remove inappropriate usage of WARN_ON() Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 026/125] ALSA: opl3: fix infoleak in opl3 Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 027/125] ALSA: hda - let hs_mic be picked ahead of hp_mic Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 028/125] ALSA: usb-audio: add quirk for MacroSilicon MS2109 Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 029/125] KVM: arm64: Fix definition of PAGE_HYP_DEVICE Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 030/125] KVM: arm64: Stop clobbering x0 for HVC_SOFT_RESTART Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 031/125] KVM: x86: bit 8 of non-leaf PDPEs is not reserved Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 032/125] KVM: x86: Inject #GP if guest attempts to toggle CR4.LA57 in 64-bit mode Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 033/125] KVM: x86: Mark CR4.TSD as being possibly owned by the guest Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 034/125] Revert "ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb" Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 035/125] btrfs: fix fatal extent_buffer readahead vs releasepage race Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 036/125] drm/radeon: fix double free Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 037/125] dm: use noio when sending kobject event Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 038/125] ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 039/125] ARC: elf: use right ELF_ARCH Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 040/125] s390/mm: fix huge pte soft dirty copying Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 041/125] genetlink: remove genl_bind Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 042/125] ipv4: fill fl4_icmp_{type,code} in ping_v4_sendmsg Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 043/125] l2tp: remove skb_dst_set() from l2tp_xmit_skb() Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 044/125] llc: make sure applications use ARPHRD_ETHER Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 045/125] net: Added pointer check for dst->ops->neigh_lookup in dst_neigh_lookup_skb Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 046/125] net: usb: qmi_wwan: add support for Quectel EG95 LTE modem Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 047/125] tcp: md5: add missing memory barriers in tcp_md5_do_add()/tcp_md5_hash_key() Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 048/125] tcp: md5: refine tcp_md5_do_add()/tcp_md5_hash_key() barriers Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 049/125] tcp: md5: allow changing MD5 keys in all socket states Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 050/125] net_sched: fix a memory leak in atm_tc_init() Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 051/125] tcp: make sure listeners dont initialize congestion-control state Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 052/125] tcp: md5: do not send silly options in SYNCOOKIES Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 053/125] cgroup: fix cgroup_sk_alloc() for sk_clone_lock() Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 054/125] cgroup: Fix sock_cgroup_data on big-endian Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 055/125] drm/exynos: fix ref count leak in mic_pre_enable Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 056/125] arm64/alternatives: use subsections for replacement sequences Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 057/125] tpm_tis: extra chip->ops check on error path in tpm_tis_core_init Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 058/125] gfs2: read-only mounts should grab the sd_freeze_gl glock Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 059/125] i2c: eg20t: Load module automatically if ID matches Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 060/125] arm64: alternative: Use true and false for boolean values Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 061/125] arm64/alternatives: dont patch up internal branches Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 062/125] iio:magnetometer:ak8974: Fix alignment and data leak issues Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 063/125] iio:humidity:hdc100x " Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 064/125] iio: magnetometer: ak8974: Fix runtime PM imbalance on error Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 065/125] iio: mma8452: Add missed iio_device_unregister() call in mma8452_probe() Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 066/125] iio: pressure: zpa2326: handle pm_runtime_get_sync failure Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 067/125] iio:pressure:ms5611 Fix buffer element alignment Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 068/125] iio:health:afe4403 Fix timestamp alignment and prevent data leak Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 069/125] spi: spi-fsl-dspi: Fix lockup if device is shutdown during SPI transfer Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 070/125] spi: fix initial SPI_SR value in spi-fsl-dspi Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 071/125] net: dsa: bcm_sf2: Fix node reference count Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 072/125] of: of_mdio: Correct loop scanning logic Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 073/125] Revert "usb/ohci-platform: Fix a warning when hibernating" Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 074/125] Revert "usb/ehci-platform: Set PM runtime as active on resume" Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 075/125] Revert "usb/xhci-plat: " Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 076/125] doc: dt: bindings: usb: dwc3: Update entries for disabling SS instances in park mode Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 077/125] mmc: sdhci: do not enable card detect interrupt for gpio cd type Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 078/125] ACPI: video: Use native backlight on Acer Aspire 5783z Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 079/125] ACPI: video: Use native backlight on Acer TravelMate 5735Z Greg Kroah-Hartman
2020-07-20 15:36 ` [PATCH 4.14 080/125] iio:health:afe4404 Fix timestamp alignment and prevent data leak Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 081/125] phy: sun4i-usb: fix dereference of pointer phy0 before it is null checked Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 082/125] arm64: dts: meson: add missing gxl rng clock Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 083/125] spi: spi-sun6i: sun6i_spi_transfer_one(): fix setting of clock rate Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 084/125] usb: gadget: udc: atmel: fix uninitialized read in debug printk Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 085/125] staging: comedi: verify array index is correct before using it Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 086/125] Revert "thermal: mediatek: fix register index error" Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 087/125] ARM: dts: socfpga: Align L2 cache-controller nodename with dtschema Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 088/125] copy_xstate_to_kernel: Fix typo which caused GDB regression Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 089/125] perf stat: Zero all the ena and run array slot stats for interval mode Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 090/125] mtd: rawnand: brcmnand: fix CS0 layout Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 091/125] mtd: rawnand: oxnas: Keep track of registered devices Greg Kroah-Hartman
2020-07-20 15:37 ` Greg Kroah-Hartman [this message]
2020-07-20 15:37 ` [PATCH 4.14 093/125] mtd: rawnand: oxnas: Release all devices in the _remove() path Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 094/125] HID: magicmouse: do not set up autorepeat Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 095/125] ALSA: line6: Perform sanity check for each URB creation Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 096/125] ALSA: usb-audio: Fix race against the error recovery URB submission Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 097/125] USB: c67x00: fix use after free in c67x00_giveback_urb Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 098/125] usb: dwc2: Fix shutdown callback in platform Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 099/125] usb: chipidea: core: add wakeup support for extcon Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 100/125] usb: gadget: function: fix missing spinlock in f_uac1_legacy Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 101/125] USB: serial: iuu_phoenix: fix memory corruption Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 102/125] USB: serial: cypress_m8: enable Simply Automated UPB PIM Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 103/125] USB: serial: ch341: add new Product ID for CH340 Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 104/125] USB: serial: option: add GosunCn GM500 series Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 105/125] USB: serial: option: add Quectel EG95 LTE modem Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 106/125] virtio: virtio_console: add missing MODULE_DEVICE_TABLE() for rproc serial Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 107/125] fuse: Fix parameter for FS_IOC_{GET,SET}FLAGS Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 108/125] Revert "zram: convert remaining CLASS_ATTR() to CLASS_ATTR_RO()" Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 109/125] mei: bus: dont clean driver pointer Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 110/125] Input: i8042 - add Lenovo XiaoXin Air 12 to i8042 nomux list Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 111/125] uio_pdrv_genirq: fix use without device tree and no interrupt Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 112/125] timer: Fix wheel index calculation on last level Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 113/125] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 114/125] hwmon: (emc2103) fix unable to change fan pwm1_enable attribute Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 115/125] intel_th: pci: Add Jasper Lake CPU support Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 116/125] intel_th: pci: Add Tiger Lake PCH-H support Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 117/125] intel_th: pci: Add Emmitsburg PCH support Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 118/125] dmaengine: fsl-edma: Fix NULL pointer exception in fsl_edma_tx_handler Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 119/125] misc: atmel-ssc: lock with mutex instead of spinlock Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 120/125] thermal/drivers/cpufreq_cooling: Fix wrong frequency converted from power Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 121/125] arm64: ptrace: Override SPSR.SS when single-stepping is enabled Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 122/125] sched/fair: handle case of task_h_load() returning 0 Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 123/125] x86/cpu: Move x86_cache_bits settings Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 124/125] libceph: dont omit recovery_deletes in target_copy() Greg Kroah-Hartman
2020-07-20 15:37 ` [PATCH 4.14 125/125] rxrpc: Fix trace string Greg Kroah-Hartman
2020-07-20 23:46 ` [PATCH 4.14 000/125] 4.14.189-rc1 review Shuah Khan
2020-07-21  9:23 ` Naresh Kamboju
2020-07-21 13:13 ` Thierry Reding
2020-07-21 16:37 ` Guenter Roeck

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=20200720152807.464303992@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=stable@vger.kernel.org \
    /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).