Skip to contentSkip to conversation

ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

PATCH In review Namjae Jeon 3 participants 4 messages May 21, 2012 – May 23, 2012 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

Avoid dereferencing a NULL pointer if scsi_host_alloc is failed.

---
 drivers/scsi/ufs/ufshcd.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +3 -2
index e47a0da..58f4ba6 100644
@@ -1838,7 +1838,7 @@ ufshcd_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	err = pci_request_regions(pdev, UFSHCD);
 	if (err < 0) {
 		dev_err(&pdev->dev, "request regions failed\n");
-		goto out_disable;
+		goto out_host_put;
 	}
 
 	hba->mmio_base = pci_ioremap_bar(pdev, 0);
@@ -1927,8 +1927,9 @@ out_iounmap:
 	iounmap(hba->mmio_base);
 out_release_regions:
 	pci_release_regions(pdev);
-out_disable:
+out_host_put:
 	scsi_host_put(host);
+out_disable:
 	pci_clear_master(pdev);
 	pci_disable_device(pdev);
 out_error:
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 1 line · On Mon, 21 May 2012 10:35:36 -0400 Namjae Jeon <[email protected]> wrote:

Subject: [PATCH] [SCSI] ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

Nit: conventionally, the text inside [] is to be discarded by the patch recipient, so the title of this patch is

ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

which makes it look like a patch against fs/ufs/!

There is a fashion lately of people prefixing patch titles along the lines of

scsi: ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

or even

drivers: scsi: ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

that's nuts, and I regularly turn this into a proper pathname - why not?

drivers/scsi/ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

I'll stop now :)

#2 lore raw

Hi. Andrew.

I will do it next time.

Thanks for your advice.

2012/5/23, Andrew Morton <[email protected]>:

Quoted 33 lines
Quoted 2 lines · On Mon, 21 May 2012 10:35:36 -0400 Namjae Jeon <[email protected]> wrote:

Subject: [PATCH] [SCSI] ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

Nit: conventionally, the text inside [] is to be discarded by the patch recipient, so the title of this patch is

ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

which makes it look like a patch against fs/ufs/!

There is a fashion lately of people prefixing patch titles along the lines of

scsi: ufs: fix potential NULL pointer dereferencing error in
ufshcd_probe.

or even

drivers: scsi: ufs: fix potential NULL pointer dereferencing error in
ufshcd_probe.

that's nuts, and I regularly turn this into a proper pathname - why not?

drivers/scsi/ufs: fix potential NULL pointer dereferencing error in
ufshcd_probe.

I'll stop now :)

maintainer
#3 lore raw
In reply to Andrew Morton
Quoted 17 lines · Andrew Morton
Quoted 1 line · On Mon, 21 May 2012 10:35:36 -0400 Namjae Jeon <[email protected]> wrote:

Subject: [PATCH] [SCSI] ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

Nit: conventionally, the text inside [] is to be discarded by the patch recipient, so the title of this patch is

ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

which makes it look like a patch against fs/ufs/!

There is a fashion lately of people prefixing patch titles along the lines of

scsi: ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

Quoted 8 lines

or even

drivers: scsi: ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

that's nuts, and I regularly turn this into a proper pathname - why not?

drivers/scsi/ufs: fix potential NULL pointer dereferencing error in ufshcd_probe.

Because it's a question of who has to mangle the patch title. If it's the latter, it's me. The [SCSI] tree tag I use implies we're in driver/scsi, so I only add extra bits if we move outside that.

James