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, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	alan@lxorguk.ukuu.org.uk, "Joel D. Diaz" <joeldiaz@us.ibm.com>,
	Hannes Reinecke <hare@suse.de>,
	James Bottomley <JBottomley@Parallels.com>,
	CAI Qian <caiqian@redhat.com>
Subject: [ 05/15] SCSI: sd: Reshuffle init_sd to avoid crash
Date: Thu, 24 Jan 2013 13:18:29 -0800	[thread overview]
Message-ID: <20130124211725.321468728@linuxfoundation.org> (raw)
In-Reply-To: <20130124211723.489089115@linuxfoundation.org>

3.0-stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Joel D. Diaz" <joeldiaz@us.ibm.com>

commit afd5e34b2bb34881d3a789e62486814a49b47faa upstream.

scsi_register_driver will register a prep_fn() function, which
in turn migh need to use the sd_cdp_pool for DIF.
Which hasn't been initialised at this point, leading to
a crash. So reshuffle the init_sd() and exit_sd() paths
to have the driver registered last.

Signed-off-by: Joel D. Diaz <joeldiaz@us.ibm.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Cc: CAI Qian <caiqian@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/sd.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2826,10 +2826,6 @@ static int __init init_sd(void)
 	if (err)
 		goto err_out;
 
-	err = scsi_register_driver(&sd_template.gendrv);
-	if (err)
-		goto err_out_class;
-
 	sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE,
 					 0, 0, NULL);
 	if (!sd_cdb_cache) {
@@ -2843,8 +2839,15 @@ static int __init init_sd(void)
 		goto err_out_cache;
 	}
 
+	err = scsi_register_driver(&sd_template.gendrv);
+	if (err)
+		goto err_out_driver;
+
 	return 0;
 
+err_out_driver:
+	mempool_destroy(sd_cdb_pool);
+
 err_out_cache:
 	kmem_cache_destroy(sd_cdb_cache);
 
@@ -2867,10 +2870,10 @@ static void __exit exit_sd(void)
 
 	SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n"));
 
+	scsi_unregister_driver(&sd_template.gendrv);
 	mempool_destroy(sd_cdb_pool);
 	kmem_cache_destroy(sd_cdb_cache);
 
-	scsi_unregister_driver(&sd_template.gendrv);
 	class_unregister(&sd_disk_class);
 
 	for (i = 0; i < SD_MAJORS; i++)



  parent reply	other threads:[~2013-01-24 21:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 21:18 [ 00/15] 3.0.61-stable review Greg Kroah-Hartman
2013-01-24 21:18 ` [ 01/15] drm/i915: Invalidate the relocation presumed_offsets along the slow path Greg Kroah-Hartman
2013-01-24 21:18 ` [ 02/15] ftrace: Be first to run code modification on modules Greg Kroah-Hartman
2013-01-24 21:18 ` [ 03/15] PCI: Allow pcie_aspm=force even when FADT indicates it is unsupported Greg Kroah-Hartman
2013-01-24 21:18 ` [ 04/15] USB: UHCI: fix IRQ race during initialization Greg Kroah-Hartman
2013-01-24 21:18 ` Greg Kroah-Hartman [this message]
2013-01-24 21:18 ` [ 06/15] drivers/firmware/dmi_scan.c: check dmi version when get system uuid Greg Kroah-Hartman
2013-01-24 21:18 ` [ 07/15] drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists Greg Kroah-Hartman
2013-01-24 21:18 ` [ 08/15] serial: 8250, increase PASS_LIMIT Greg Kroah-Hartman
2013-01-24 21:18 ` [ 09/15] staging: usbip: changed function return type to void Greg Kroah-Hartman
2013-01-24 21:18 ` [ 10/15] drm/i915: Implement WaDisableHiZPlanesWhenMSAAEnabled Greg Kroah-Hartman
2013-01-24 21:18 ` [ 11/15] ahci: Add identifiers for ASM106x devices Greg Kroah-Hartman
2013-01-25 20:45   ` Jerry Snitselaar
2013-01-25 22:00     ` Abdallah Chatila
2013-01-28  4:42       ` Greg Kroah-Hartman
2013-01-24 21:18 ` [ 12/15] x86: Use enum instead of literals for trap values [PARTIAL] Greg Kroah-Hartman
2013-01-24 21:18 ` [ 13/15] SGI-XP: handle non-fatal traps Greg Kroah-Hartman
2013-01-24 21:18 ` [ 14/15] ACPI / cpuidle: Fix NULL pointer issues when cpuidle is disabled Greg Kroah-Hartman
2013-01-24 21:18 ` [ 15/15] ioat: Fix DMA memory sync direction correct flag Greg Kroah-Hartman
2013-01-25 18:04 ` [ 00/15] 3.0.61-stable review Shuah Khan
2013-01-26 11:58 ` Satoru Takeuchi

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=20130124211725.321468728@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=JBottomley@Parallels.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=caiqian@redhat.com \
    --cc=hare@suse.de \
    --cc=joeldiaz@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).