public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Simon Arlott <simon@octiron.net>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-scsi@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 27/80] scsi: sr: Fix sr_probe() missing deallocate of device minor
Date: Wed, 17 Jun 2020 21:27:26 -0400	[thread overview]
Message-ID: <20200618012819.609778-27-sashal@kernel.org> (raw)
In-Reply-To: <20200618012819.609778-1-sashal@kernel.org>

From: Simon Arlott <simon@octiron.net>

[ Upstream commit 6555781b3fdec5e94e6914511496144241df7dee ]

If the cdrom fails to be registered then the device minor should be
deallocated.

Link: https://lore.kernel.org/r/072dac4b-8402-4de8-36bd-47e7588969cd@0882a8b5-c6c3-11e9-b005-00805fc181fe
Signed-off-by: Simon Arlott <simon@octiron.net>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/sr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index cc484cb287d2..67a73ea0a615 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -745,7 +745,7 @@ static int sr_probe(struct device *dev)
 	cd->cdi.disk = disk;
 
 	if (register_cdrom(&cd->cdi))
-		goto fail_put;
+		goto fail_minor;
 
 	/*
 	 * Initialize block layer runtime PM stuffs before the
@@ -763,6 +763,10 @@ static int sr_probe(struct device *dev)
 
 	return 0;
 
+fail_minor:
+	spin_lock(&sr_index_lock);
+	clear_bit(minor, sr_index_bits);
+	spin_unlock(&sr_index_lock);
 fail_put:
 	put_disk(disk);
 fail_free:
-- 
2.25.1


  parent reply	other threads:[~2020-06-18  1:44 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18  1:27 [PATCH AUTOSEL 4.9 01/80] power: supply: bq24257_charger: Replace depends on REGMAP_I2C with select Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 02/80] clk: sunxi: Fix incorrect usage of round_down() Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 03/80] i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 04/80] iio: pressure: bmp280: Tolerate IRQ before registering Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 05/80] iio: light: isl29125: fix iio_triggered_buffer_{predisable,postenable} positions Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 06/80] clk: qcom: msm8916: Fix the address location of pll->config_reg Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 07/80] backlight: lp855x: Ensure regulators are disabled on probe failure Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 08/80] ARM: integrator: Add some Kconfig selections Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 09/80] ALSA: isa/wavefront: prevent out of bounds write in ioctl Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 10/80] Smack: slab-out-of-bounds in vsscanf Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 11/80] scsi: qla2xxx: Fix issue with adapter's stopping state Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 12/80] iio: bmp280: fix compensation of humidity Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 13/80] i2c: pxa: clear all master action bits in i2c_pxa_stop_message() Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 14/80] usblp: poison URBs upon disconnect Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 15/80] PCI: aardvark: Don't blindly enable ASPM L0s and don't write to read-only register Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 16/80] ps3disk: use the default segment boundary Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 17/80] vfio/pci: fix memory leaks in alloc_perm_bits() Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 18/80] mfd: wm8994: Fix driver operation if loaded as modules Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 19/80] scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 20/80] clk: clk-flexgen: fix clock-critical handling Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 21/80] powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple hv-24x7 events run Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 22/80] nfsd: Fix svc_xprt refcnt leak when setup callback client failed Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 23/80] powerpc/crashkernel: Take "mem=" option into account Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 24/80] yam: fix possible memory leak in yam_init_driver Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 25/80] fat: don't allow to mount if the FAT length == 0 Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 26/80] mksysmap: Fix the mismatch of '.L' symbols in System.map Sasha Levin
2020-06-18  1:27 ` Sasha Levin [this message]
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 28/80] scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 29/80] staging: rtl8712: fix multiline derefernce warnings Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 30/80] iio: buffer: Don't allow buffers without any channels enabled to be activated Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 31/80] ALSA: usb-audio: Improve frames size computation Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 32/80] s390/qdio: put thinint indicator after early error Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 33/80] tty: hvc: Fix data abort due to race in hvc_open Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 34/80] staging: sm750fb: add missing case while setting FB_VISUAL Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 35/80] i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 36/80] serial: amba-pl011: Make sure we initialize the port.lock spinlock Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 37/80] drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 38/80] PCI: rcar: Fix incorrect programming of OB windows Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 39/80] PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 40/80] power: supply: lp8788: Fix an error handling path in 'lp8788_charger_probe()' Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 41/80] power: supply: smb347-charger: IRQSTAT_D is volatile Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 42/80] scsi: mpt3sas: Fix double free warnings Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 43/80] dlm: remove BUG() before panic() Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 44/80] clk: ti: composite: fix memory leak Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 45/80] tty: n_gsm: Fix SOF skipping Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 46/80] tty: n_gsm: Fix waking up upper tty layer when room available Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 47/80] powerpc/pseries/ras: Fix FWNMI_VALID off by one Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 48/80] powerpc/ps3: Fix kexec shutdown hang Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 49/80] vfio-pci: Mask cap zero Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 50/80] usb/ohci-platform: Fix a warning when hibernating Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 51/80] drm/msm/mdp5: Fix mdp5_init error path for failed mdp5_kms allocation Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 52/80] USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe() Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 53/80] tty: n_gsm: Fix bogus i++ in gsm_data_kick Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 54/80] clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1 Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 55/80] powerpc/64s/pgtable: fix an undefined behaviour Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 56/80] PCI/PTM: Inherit Switch Downstream Port PTM settings from Upstream Port Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 57/80] IB/cma: Fix ports memory leak in cma_configfs Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 58/80] watchdog: da9062: No need to ping manually before setting timeout Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 59/80] usb: dwc2: gadget: move gadget resume after the core is in L0 state Sasha Levin
2020-06-18  1:27 ` [PATCH AUTOSEL 4.9 60/80] USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 61/80] usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 62/80] usb: gadget: fix potential double-free in m66592_probe Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 63/80] usb: gadget: Fix issue with config_ep_by_speed function Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 64/80] vfio/pci: fix memory leaks of eventfd ctx Sasha Levin
2020-06-18  1:34   ` Alex Williamson
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 65/80] clk: bcm2835: Fix return type of bcm2835_register_gate Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 66/80] net: sunrpc: Fix off-by-one issues in 'rpc_ntop6' Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 67/80] NFSv4.1 fix rpc_call_done assignment for BIND_CONN_TO_SESSION Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 68/80] extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()' Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 69/80] ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 70/80] openrisc: Fix issue with argument clobbering for clone/fork Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 71/80] gfs2: Allow lock_nolock mount to specify jid=X Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 72/80] scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 73/80] pinctrl: imxl: Fix an error handling path in 'imx1_pinctrl_core_probe()' Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 74/80] crypto: omap-sham - add proper load balancing support for multicore Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 75/80] lib/zlib: remove outdated and incorrect pre-increment optimization Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 76/80] include/linux/bitops.h: avoid clang shift-count-overflow warnings Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 77/80] elfnote: mark all .note sections SHF_ALLOC Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 78/80] selftests/vm/pkeys: fix alloc_random_pkey() to make it really random Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 79/80] selftests/net: in timestamping, strncpy needs to preserve null byte Sasha Levin
2020-06-18  1:28 ` [PATCH AUTOSEL 4.9 80/80] scsi: acornscsi: Fix an error handling path in acornscsi_probe() 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=20200618012819.609778-27-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=simon@octiron.net \
    --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