rtc: max8998: Check for pdata presence before dereferencing
Subsystems (2)
PATCH 1/1 rtc: max8998: Check for pdata presence before dereferencing
Currently the driver can crash with a NULL pointer dereference if no pdata is provided, despite of successful registration of MFD part. This patch fixes the problem by adding a NULL check before dereferencing the pdata pointer.
--- drivers/rtc/rtc-max8998.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-max8998.c +1 -1
@@ -285,7 +285,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) info->irq, ret);dev_info (&pdev->dev,"RTC CHIP NAME: %s\n" , pdev->id_entry->name); -if (pdata->rtc_delay) { +if (pdata && pdata->rtc_delay) { info->lp3974_bug_workaround = true;dev_warn (&pdev->dev,"LP3974 with RTC REGERR option." " RTC updates will be extremely slow.\n" );
Signature · 1 line
1.8.2.1
PATCH 1/1 rtc: max8998: Check for pdata presence before dereferencing
CCing Andrew Morton.
Quoted 31 lines · Tomasz Figa
Currently the driver can crash with a NULL pointer dereference if no pdata is provided, despite of successful registration of MFD part. This patch fixes the problem by adding a NULL check before dereferencing the pdata pointer.
Signed-off-by Tomasz Figa <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- drivers/rtc/rtc-max8998.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/rtc/rtc-max8998.c +1
-2@@ -285,7 +285,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) info->irq, ret);dev_info (&pdev->dev,"RTC CHIP NAME: %s\n" , pdev->id_entry->name); -if (pdata->rtc_delay) { +if (pdata && pdata->rtc_delay) { info->lp3974_bug_workaround = true;dev_warn (&pdev->dev,"LP3974 with RTC REGERR option." " RTC updates will be extremely slow.\n" ); --1.8.2.1
--
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
Signature · 2 lines
With warm regards, Sachin
PATCH 1/1 rtc: max8998: Check for pdata presence before dereferencing
In reply to Tomasz FigaHi Alessandro,
Quoted 16 lines · On Wednesday 15 of May 2013 17:16:08 Tomasz Figa wrote:
Currently the driver can crash with a NULL pointer dereference if no pdata is provided, despite of successful registration of MFD part. This patch fixes the problem by adding a NULL check before dereferencing the pdata pointer.
Signed-off-by Tomasz Figa <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- drivers/rtc/rtc-max8998.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/rtc/rtc-max8998.c +0
-0
drivers/rtc/rtc-max8998.c static int max8998_rtc_probe(struct platform_device · line 291
Quoted 8 lines
drivers/rtc/rtc-max8998.c +1
-1@@ -285,7 +285,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) info->irq, ret);dev_info (&pdev->dev,"RTC CHIP NAME: %s\n" , pdev->id_entry->name); -if (pdata->rtc_delay) { +if (pdata && pdata->rtc_delay) { info->lp3974_bug_workaround = true;dev_warn (&pdev->dev,"LP3974 with RTC REGERR option." " RTC updates will be extremely slow.\n" );
Since this is a fix, could you apply this patch to your fixes branch for 3.10-rc2, please?
Best regards,
Tomasz
PATCH 1/1 rtc: max8998: Check for pdata presence before dereferencing
In reply to Tomasz FigaQuoted 10 lines · On Wed, 15 May 2013 17:16:08 +0200 Tomasz Figa <[email protected]> wrote:
Currently the driver can crash with a NULL pointer dereference if no pdata is provided, despite of successful registration of MFD part. This patch fixes the problem by adding a NULL check before dereferencing the pdata pointer.
...
drivers/rtc/rtc-max8998.c static int max8998_rtc_probe(struct platform_device *pdev) · line 291
Quoted 8 lines
drivers/rtc/rtc-max8998.c +1
-1@@ -285,7 +285,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) info->irq, ret);dev_info (&pdev->dev,"RTC CHIP NAME: %s\n" , pdev->id_entry->name); -if (pdata->rtc_delay) { +if (pdata && pdata->rtc_delay) { info->lp3974_bug_workaround = true;dev_warn (&pdev->dev,"LP3974 with RTC REGERR option." " RTC updates will be extremely slow.\n" );
Looking at your description I'm unable to determine which kernel versions we should fix. This is because the changelog didn't describe the circumstances under which the bug triggers.
It's pretty simple: when fixing a bug, include a full description of the bug! As if you were sending a bug report, not a patch.