Skip to contentSkip to conversation

sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

PATCH New Marek Szyprowski 4 participants 7 messages Sep 23, 2010 – Sep 27, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

If not all clocks has been defined in platform data, driver will cause a null pointer dereference when it is being removed. This patch fixes this issue.

---
 drivers/mmc/host/sdhci-s3c.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-s3c.c +4 -2
index 71ad416..757d92c 100644
@@ -481,8 +481,10 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
 	sdhci_remove_host(host, 1);
 
 	for (ptr = 0; ptr < 3; ptr++) {
-		clk_disable(sc->clk_bus[ptr]);
-		clk_put(sc->clk_bus[ptr]);
+		if (sc->clk_bus[ptr]) {
+			clk_disable(sc->clk_bus[ptr]);
+			clk_put(sc->clk_bus[ptr]);
+		}
 	}
 	clk_disable(sc->clk_io);
 	clk_put(sc->clk_io);
Signature · 1 line
1.7.1.569.g6f426
#1 lore raw

PATCH 1/1 sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

Quoted 17 lines · On Thu, 23 Sep 2010 16:22:05 +0200 Marek Szyprowski <[email protected]>…

If not all clocks has been defined in platform data, driver will cause a null pointer dereference when it is being removed. This patch fixes this issue.

---
 drivers/mmc/host/sdhci-s3c.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-s3c.c +0 -0
index 71ad416..757d92c 100644
@@ -481,8 +481,10 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
 	sdhci_remove_host(host, 1);
 

drivers/mmc/host/sdhci-s3c.c static int __devexit sdhci_s3c_remove(struct platform_device *pdev) · line 490

Quoted 10 lines
drivers/mmc/host/sdhci-s3c.c +4 -2
 	for (ptr = 0; ptr < 3; ptr++) {
-		clk_disable(sc->clk_bus[ptr]);
-		clk_put(sc->clk_bus[ptr]);
+		if (sc->clk_bus[ptr]) {
+			clk_disable(sc->clk_bus[ptr]);
+			clk_put(sc->clk_bus[ptr]);
+		}
 	}
 	clk_disable(sc->clk_io);
 	clk_put(sc->clk_io);

The patch applies OK to 2.6.35. Is the bug present there as well? If so, should we fix it in earlier kernels? If so then the way in which we indicate this is by adding

to the changelog.

#2 lore raw

PATCH 1/1 sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

Quoted 7 lines · Andrew Morton

The patch applies OK to 2.6.35. Is the bug present there as well? If so, should we fix it in earlier kernels? If so then the way in which we indicate this is by adding

to the changelog.

Marek, Kyungmin, what do you think?

Andrew, I've been waiting for an ACK from Ben Dooks, since he's listed in MAINTAINERS for this driver, but he hasn't replied yet (I've tried pinging privately). I'll plan on sending Marek's two s3c fixes to Linus tomorrow regardless (this one with Cc: <[email protected]>) along with my MAINTAINERS update for MMC unless anyone objects.

Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#3 lore raw

PATCH 1/1 sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

Quoted 10 lines · Chris Ball
Quoted 7 lines · Andrew Morton

The patch applies OK to 2.6.35. ?Is the bug present there as well? ?If so, should we fix it in earlier kernels? ?If so then the way in which we indicate this is by adding

? ? ? Cc: <[email protected]>

to the changelog.

Marek, Kyungmin, what do you think?

Of course my opinion is should be merged at this time.
In normal case it's built as static module. so there's no complains. but it should be fixed.
My SOB is already included at patch. so no need to ACK from me.

Thank you,
Kyungmin Park

Quoted 17 lines

Andrew, I've been waiting for an ACK from Ben Dooks, since he's listed in MAINTAINERS for this driver, but he hasn't replied yet (I've tried pinging privately). ?I'll plan on sending Marek's two s3c fixes to Linus tomorrow regardless (this one with Cc: <[email protected]>) along with my MAINTAINERS update for MMC unless anyone objects.

Thanks,

--
Chris Ball ? <[email protected]> ? <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH 1/1 sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

Hi Kyungmin,

Quoted 8 lines · Kyungmin Park
Quoted 7 lines · Chris Ball
Quoted 6 lines · Andrew Morton

The patch applies OK to 2.6.35. ?Is the bug present there as well? ?If so, should we fix it in earlier kernels? ?If so then the way in which we indicate this is by adding

? ? ? Cc: <[email protected]>

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

to the changelog.

Marek, Kyungmin, what do you think?

Of course my opinion is should be merged at this time.
In normal case it's built as static module. so there's no complains. but it should be fixed.
My SOB is already included at patch. so no need to ACK from me.

Andrew's question isn't whether it should be merged, but whether it should also be applied to the stable kernel, since the bug appears to be present in the 2.6.35 release as well.

Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#5 lore raw

PATCH 1/1 sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

In reply to Chris Ball

Hello,

Quoted 9 lines · Chris Ball
Quoted 7 lines · Andrew Morton

The patch applies OK to 2.6.35. Is the bug present there as well? If so, should we fix it in earlier kernels? If so then the way in which we indicate this is by adding

to the changelog.

Quoted 7 lines

Marek, Kyungmin, what do you think?

Andrew, I've been waiting for an ACK from Ben Dooks, since he's listed in MAINTAINERS for this driver, but he hasn't replied yet (I've tried pinging privately). I'll plan on sending Marek's two s3c fixes to Linus tomorrow regardless (this one with Cc: <[email protected]>) along with my MAINTAINERS update for MMC unless anyone objects.

I'm sorry, I was on holidays. You are right, both fixes should go to 2.6.36 as well

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

#6 lore raw

PATCH 1/1 sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

In reply to Marek Szyprowski

Hi Ben,

Quoted 17 lines · Marek Szyprowski

If not all clocks has been defined in platform data, driver will cause a null pointer dereference when it is being removed. This patch fixes this issue.

---
 drivers/mmc/host/sdhci-s3c.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-s3c.c +0 -0
index 71ad416..757d92c 100644
@@ -481,8 +481,10 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
 	sdhci_remove_host(host, 1);
 

drivers/mmc/host/sdhci-s3c.c static int __devexit sdhci_s3c_remove(struct platform_device *pdev) · line 490

Quoted 10 lines
drivers/mmc/host/sdhci-s3c.c +4 -2
 	for (ptr = 0; ptr < 3; ptr++) {
-		clk_disable(sc->clk_bus[ptr]);
-		clk_put(sc->clk_bus[ptr]);
+		if (sc->clk_bus[ptr]) {
+			clk_disable(sc->clk_bus[ptr]);
+			clk_put(sc->clk_bus[ptr]);
+		}
 	}
 	clk_disable(sc->clk_io);
 	clk_put(sc->clk_io);

I'll send this to Linus for .36 after you reply with an ACK.

Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child