[alsa-devel] [PATCH] ASoC: txx9aclc_ac97: Fix kernel crash on probe

This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.
Signed-off-by: Alexander Shiyan shc_work@mail.ru --- sound/soc/txx9/txx9aclc-ac97.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c index e0305a1..9edd68d 100644 --- a/sound/soc/txx9/txx9aclc-ac97.c +++ b/sound/soc/txx9/txx9aclc-ac97.c @@ -183,14 +183,16 @@ static int txx9aclc_ac97_dev_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); drvdata->base = devm_ioremap_resource(&pdev->dev, r); if (IS_ERR(drvdata->base)) return PTR_ERR(drvdata->base);
- drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) - return -ENOMEM; platform_set_drvdata(pdev, drvdata); drvdata->physbase = r->start; if (sizeof(drvdata->physbase) > sizeof(r->start) &&

On Sat, Feb 15, 2014 at 11:28:29PM +0400, Alexander Shiyan wrote:
This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.
Applied, thanks.

On Sat, Feb 15, 2014 at 11:28:29PM +0400, Alexander Shiyan wrote:
This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.
I don't know where you got that hash from by the way, that commit isn't present in mainline?

Воскресенье, 16 февраля 2014, 8:38 +08:00 от Mark Brown broonie@kernel.org:
On Sat, Feb 15, 2014 at 11:28:29PM +0400, Alexander Shiyan wrote:
This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.
I don't know where you got that hash from by the way, that commit isn't present in mainline?
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/sound...
---

On Sun, Feb 16, 2014 at 06:55:53AM +0400, Alexander Shiyan wrote:
Воскресенье, 16 февраля 2014, 8:38 +08:00 от Mark Brown broonie@kernel.org:
On Sat, Feb 15, 2014 at 11:28:29PM +0400, Alexander Shiyan wrote:
This patch fixes a crash caused by commit af5b2d7519
I don't know where you got that hash from by the way, that commit isn't present in mainline?
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/sound...
A shortened commit ID is the *start* of the ID, not the end. Try running 'git show af5b2d7519'.
participants (2)
-
Alexander Shiyan
-
Mark Brown