[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <51F00CD8.9000601@wwwdotorg.org>
Date: Wed, 24 Jul 2013 10:20:24 -0700
From: Stephen Warren <swarren@...dotorg.org>
To: Rhyland Klein <rklein@...dia.com>
CC: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Joseph Lo <josephl@...dia.com>, linux-kernel@...r.kernel.org,
linux-tegra@...r.kernel.org
Subject: Re: [PATCH] regulator: palmas: fix pdata ptr not be updated after
it has been allocated
On 07/24/2013 09:28 AM, Rhyland Klein wrote:
> The pmic platform data wasn't updated to dev.platform_data after it had
> been allocated. That can cause the driver crash when using it.
> This patch fixes the issue.
>
> We need to update the pdata pointer at the end of probe because if
> probe should fail for some reason, for instance if an in-supply
> isn't ready yet, then probe will defer. However, the pdata is allocated
> with devm, and so is freed when probe is deferred.
This looks wrong. If the module is removed and re-probed, then the pdata
pointer will still be set to a stale (free'd) value and hence not
re-allocated, but it will still be used.
This function shouldn't save the pdata in dev.platform_data, but rather
some data structure that has the same scope as probe()..remove(), for
example as a field in the drvdata struct, as set by dev_set_drvdata().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists