Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1278404 > unrolled thread
| Started by | martin.wilck@ts.fujitsu.com |
|---|---|
| First post | 2015-11-26 20:20 +0100 |
| Last post | 2015-11-30 14:10 +0100 |
| Articles | 14 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH] base/platform: fix panic when probe function is NULL martin.wilck@ts.fujitsu.com - 2015-11-26 20:20 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2015-11-26 21:40 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL "Wilck, Martin" <martin.wilck@ts.fujitsu.com> - 2015-11-27 08:40 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-28 17:50 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-28 17:50 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2015-11-29 00:00 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-30 14:00 +0100
Re: [PATCH] base/platform: fix panic when probe function is NULL Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2015-11-27 11:20 +0100
Re: [PATCH] base/platform: fix panic when probe function is NULL "Wilck, Martin" <martin.wilck@ts.fujitsu.com> - 2015-11-30 08:50 +0100
[PATCH v2] base/platform: return success when probe function is NULL martin.wilck@ts.fujitsu.com - 2015-11-30 13:00 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-28 17:40 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2015-11-29 11:00 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-30 14:00 +0100
Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-30 14:10 +0100
| From | martin.wilck@ts.fujitsu.com |
|---|---|
| Date | 2015-11-26 20:20 +0100 |
| Subject | [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qzaff-Tv-9@gated-at.bofh.it> |
From: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
Since b8b2c7d845d5, platform_drv_probe() is called for all platform
devices. If drv->probe is NULL, and dev_pm_domain_attach() fails,
platform_drv_probe() will return the error code from dev_pm_domain_attach().
This causes real_probe() to enter the "probe_failed" path and set
dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume
success if both dev->bus->probe and drv->probe are missing.
This may cause a panic later. For example, inserting the tpm_tis
driver with parameter "force=1" (i.e. registering tpm_tis as a platform
driver) will panic in tpmm_chip_alloc() because dev->driver is NULL:
chip->cdev.owner = chip->pdev->driver->owner;
This patch fixes this by returning success in platform_drv_probe() if
"just" dev_pm_domain_attach() had failed. This restores the semantics
of platform_device_register_XXX() if the associated platform driver has
no "probe" function.
Fixes: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain
callbacks are called unconditionally")
Signed-off-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
---
drivers/base/platform.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 1dd6d3b..c994e76 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -513,10 +513,14 @@ static int platform_drv_probe(struct device *_dev)
return ret;
ret = dev_pm_domain_attach(_dev, true);
- if (ret != -EPROBE_DEFER && drv->probe) {
- ret = drv->probe(dev);
- if (ret)
- dev_pm_domain_detach(_dev, true);
+ if (ret != -EPROBE_DEFER) {
+ if (drv->probe) {
+ ret = drv->probe(dev);
+ if (ret)
+ dev_pm_domain_detach(_dev, true);
+ } else
+ /* don't fail if just dev_pm_domain_attach failed */
+ ret = 0;
}
if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Date | 2015-11-26 21:40 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qzbuG-1By-9@gated-at.bofh.it> |
| In reply to | #1278404 |
On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wilck@ts.fujitsu.com wrote: > From: Martin Wilck <Martin.Wilck@ts.fujitsu.com> > > Since b8b2c7d845d5, platform_drv_probe() is called for all platform > devices. If drv->probe is NULL, and dev_pm_domain_attach() fails, > platform_drv_probe() will return the error code from dev_pm_domain_attach(). > > This causes real_probe() to enter the "probe_failed" path and set > dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume > success if both dev->bus->probe and drv->probe are missing. > > This may cause a panic later. For example, inserting the tpm_tis > driver with parameter "force=1" (i.e. registering tpm_tis as a platform > driver) will panic in tpmm_chip_alloc() because dev->driver is NULL: > > chip->cdev.owner = chip->pdev->driver->owner; Is this happening because tpm_tis is not creating the platform device properly? ie it just calls platform_device_register_simple and then force initializes it via tpm_tis_init, which expects to be called from a probe function with an attached driver. Instead we should setup a proper platform device with the default IO range for x86 and let the driver core call tpm_tis_init via tis_drv.probe. Would changing things in this way fix the problem you've observed? I have some patches to do this that are part of my OF enablement series, but I can make something simpler that would deal with this fairly quickly if you can test. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Wilck, Martin" <martin.wilck@ts.fujitsu.com> |
|---|---|
| Date | 2015-11-27 08:40 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qzlNo-8gf-21@gated-at.bofh.it> |
| In reply to | #1278430 |
T24gRG8sIDIwMTUtMTEtMjYgYXQgMTM6MzAgLTA3MDAsIEphc29uIEd1bnRob3JwZSB3cm90ZToK PiBPbiBUaHUsIE5vdiAyNiwgMjAxNSBhdCAwODowMTozNFBNICswMTAwLCBtYXJ0aW4ud2lsY2tA dHMuZnVqaXRzdS5jb20gd3JvdGU6Cj4gPiBGcm9tOiBNYXJ0aW4gV2lsY2sgPE1hcnRpbi5XaWxj a0B0cy5mdWppdHN1LmNvbT4KPiA+IAo+ID4gU2luY2UgYjhiMmM3ZDg0NWQ1LCBwbGF0Zm9ybV9k cnZfcHJvYmUoKSBpcyBjYWxsZWQgZm9yIGFsbCBwbGF0Zm9ybQo+ID4gZGV2aWNlcy4gSWYgZHJ2 LT5wcm9iZSBpcyBOVUxMLCBhbmQgZGV2X3BtX2RvbWFpbl9hdHRhY2goKSBmYWlscywKPiA+IHBs YXRmb3JtX2Rydl9wcm9iZSgpIHdpbGwgcmV0dXJuIHRoZSBlcnJvciBjb2RlIGZyb20gZGV2X3Bt X2RvbWFpbl9hdHRhY2goKS4KPiA+IAo+ID4gVGhpcyBjYXVzZXMgcmVhbF9wcm9iZSgpIHRvIGVu dGVyIHRoZSAicHJvYmVfZmFpbGVkIiBwYXRoIGFuZCBzZXQKPiA+IGRldi0+ZHJpdmVyIHRvIE5V TEwuIEJlZm9yZSBiOGIyYzdkODQ1ZDUsIHJlYWxfcHJvYmUoKSB3b3VsZCBhc3N1bWUKPiA+IHN1 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ger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2015-11-28 17:50 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qzQRc-2PH-5@gated-at.bofh.it> |
| In reply to | #1278430 |
On Sat, Nov 28, 2015 at 06:40:03PM +0200, Jarkko Sakkinen wrote: > On Thu, Nov 26, 2015 at 01:30:31PM -0700, Jason Gunthorpe wrote: > > On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wilck@ts.fujitsu.com wrote: > > > From: Martin Wilck <Martin.Wilck@ts.fujitsu.com> > > > > > > Since b8b2c7d845d5, platform_drv_probe() is called for all platform > > > devices. If drv->probe is NULL, and dev_pm_domain_attach() fails, > > > platform_drv_probe() will return the error code from dev_pm_domain_attach(). > > > > > > This causes real_probe() to enter the "probe_failed" path and set > > > dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume > > > success if both dev->bus->probe and drv->probe are missing. > > > > > > This may cause a panic later. For example, inserting the tpm_tis > > > driver with parameter "force=1" (i.e. registering tpm_tis as a platform > > > driver) will panic in tpmm_chip_alloc() because dev->driver is NULL: > > > > > > chip->cdev.owner = chip->pdev->driver->owner; > > > > Is this happening because tpm_tis is not creating the platform device > > properly? ie it just calls platform_device_register_simple and then > > force initializes it via tpm_tis_init, which expects to be called from > > a probe function with an attached driver. > > Agreed. We should have a probe callback. > > > Instead we should setup a proper platform device with the default > > IO range for x86 and let the driver core call tpm_tis_init via > > tis_drv.probe. > > > > Would changing things in this way fix the problem you've observed? > > > > I have some patches to do this that are part of my OF enablement > > series, but I can make something simpler that would deal with this > > fairly quickly if you can test. > > Does the patch set that you sent include the fix or not? I haven't yet > reviewed them properly. Another question: does you patch series include an alternative fix for the probe bug or should I just pick Martins fix? As I sad previously I was seriously lost with the race but now I understand what you and Martin were saying (and feel utterly stupid + ashamed!). Now I'm just thinking, which fix I should pick. Anyway, I'll try to go through your code ASAP. /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2015-11-28 17:50 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qzQRc-2PH-7@gated-at.bofh.it> |
| In reply to | #1278430 |
On Thu, Nov 26, 2015 at 01:30:31PM -0700, Jason Gunthorpe wrote: > On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wilck@ts.fujitsu.com wrote: > > From: Martin Wilck <Martin.Wilck@ts.fujitsu.com> > > > > Since b8b2c7d845d5, platform_drv_probe() is called for all platform > > devices. If drv->probe is NULL, and dev_pm_domain_attach() fails, > > platform_drv_probe() will return the error code from dev_pm_domain_attach(). > > > > This causes real_probe() to enter the "probe_failed" path and set > > dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume > > success if both dev->bus->probe and drv->probe are missing. > > > > This may cause a panic later. For example, inserting the tpm_tis > > driver with parameter "force=1" (i.e. registering tpm_tis as a platform > > driver) will panic in tpmm_chip_alloc() because dev->driver is NULL: > > > > chip->cdev.owner = chip->pdev->driver->owner; > > Is this happening because tpm_tis is not creating the platform device > properly? ie it just calls platform_device_register_simple and then > force initializes it via tpm_tis_init, which expects to be called from > a probe function with an attached driver. Agreed. We should have a probe callback. > Instead we should setup a proper platform device with the default > IO range for x86 and let the driver core call tpm_tis_init via > tis_drv.probe. > > Would changing things in this way fix the problem you've observed? > > I have some patches to do this that are part of my OF enablement > series, but I can make something simpler that would deal with this > fairly quickly if you can test. Does the patch set that you sent include the fix or not? I haven't yet reviewed them properly. > Jason /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Date | 2015-11-29 00:00 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qzWDg-6xS-15@gated-at.bofh.it> |
| In reply to | #1279177 |
On Sat, Nov 28, 2015 at 06:40:03PM +0200, Jarkko Sakkinen wrote: > > I have some patches to do this that are part of my OF enablement > > series, but I can make something simpler that would deal with this > > fairly quickly if you can test. > > Does the patch set that you sent include the fix or not? I haven't yet > reviewed them properly. No fixing probe is another task. I can send some patches for that when we are done with the IRQ stuff. That is something we should fix no matter what.. BTW, please test my IRQ series, I forgot to mention I was unable to test it properly here... Jason -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2015-11-30 14:00 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qAwdI-3Lg-15@gated-at.bofh.it> |
| In reply to | #1279243 |
On Sat, Nov 28, 2015 at 03:52:51PM -0700, Jason Gunthorpe wrote: > On Sat, Nov 28, 2015 at 06:40:03PM +0200, Jarkko Sakkinen wrote: > > > I have some patches to do this that are part of my OF enablement > > > series, but I can make something simpler that would deal with this > > > fairly quickly if you can test. > > > > Does the patch set that you sent include the fix or not? I haven't yet > > reviewed them properly. > > No fixing probe is another task. I can send some patches for that when > we are done with the IRQ stuff. That is something we should fix no > matter what.. > > BTW, please test my IRQ series, I forgot to mention I was unable to > test it properly here... Got you. I need to at least test insmod/rmod (maybe couple of times in a cycle). Do you see any other code paths that could easily break because of your patches? > Jason /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
|---|---|
| Date | 2015-11-27 11:20 +0100 |
| Message-ID | <qzoie-1vq-13@gated-at.bofh.it> |
| In reply to | #1278404 |
Hello Martin,
On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wilck@ts.fujitsu.com wrote:
> From: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
>
> Since b8b2c7d845d5, platform_drv_probe() is called for all platform
> devices. If drv->probe is NULL, and dev_pm_domain_attach() fails,
> platform_drv_probe() will return the error code from dev_pm_domain_attach().
Correct, this is an unintended change of behaviour introduced in
b8b2c7d845d5.
> This causes real_probe() to enter the "probe_failed" path and set
> dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume
> success if both dev->bus->probe and drv->probe are missing.
>
> This may cause a panic later. For example, inserting the tpm_tis
> driver with parameter "force=1" (i.e. registering tpm_tis as a platform
> driver) will panic in tpmm_chip_alloc() because dev->driver is NULL:
>
> chip->cdev.owner = chip->pdev->driver->owner;
This sounds like a separate issue though. Looking at init_tis there is:
rc = platform_driver_register(&tis_drv);
if (rc < 0)
return rc;
pdev = platform_device_register_simple("tpm_tis", -1, NULL, 0);
if (IS_ERR(pdev)) {
rc = PTR_ERR(pdev);
goto err_dev;
}
rc = tpm_tis_init(&pdev->dev, &tis_default_info, NULL);
tpm_tis_init calls tpmm_chip_alloc which barfs when pdev (i.e. the return value
of platform_device_register_simple above) isn't bound. It is not allowed
to assume that the device is bound after the above function calls.
So I'd say drop the paragraph about tpm_tis and the change is fine.
> This patch fixes this by returning success in platform_drv_probe() if
> "just" dev_pm_domain_attach() had failed. This restores the semantics
> of platform_device_register_XXX() if the associated platform driver has
> no "probe" function.
>
> Fixes: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain
> callbacks are called unconditionally")
>
I think line breaks in the Fixes: line are frowned on. Also usually
there is no empty line between Fixes: and S-o-b:.
> Signed-off-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
> ---
> drivers/base/platform.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 1dd6d3b..c994e76 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -513,10 +513,14 @@ static int platform_drv_probe(struct device *_dev)
> return ret;
>
> ret = dev_pm_domain_attach(_dev, true);
> - if (ret != -EPROBE_DEFER && drv->probe) {
> - ret = drv->probe(dev);
> - if (ret)
> - dev_pm_domain_detach(_dev, true);
> + if (ret != -EPROBE_DEFER) {
> + if (drv->probe) {
> + ret = drv->probe(dev);
> + if (ret)
> + dev_pm_domain_detach(_dev, true);
> + } else
> + /* don't fail if just dev_pm_domain_attach failed */
> + ret = 0;
An else that has a } should also have a {, according to
checkpatch and Documentation/CodingStyle. You can write it
alternatively as:
if (ret != -EPROBE_DEFER) {
if (drv->probe)
ret = drv->probe(dev);
else
ret = 0;
if (ret)
dev_pm_domain_detach(_dev, true);
}
.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Wilck, Martin" <martin.wilck@ts.fujitsu.com> |
|---|---|
| Date | 2015-11-30 08:50 +0100 |
| Message-ID | <qArnI-Ea-9@gated-at.bofh.it> |
| In reply to | #1278700 |
SGVsbG8gVXdlLAoKdGhhbmtzIGZvciB5b3VyIHJldmlldy4KCj4gVGhpcyBtYXkgY2F1c2UgYSBw YW5pYyBs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JCQkJZGV2X3BtX2RvbWFpbl9kZXRhY2goX2RldiwgdHJ1ZSk7Cj4g PiArCQl9IGVsc2UKPiA+ICsJCQkvKiBkb24ndCBmYWlsIGlmIGp1c3QgZGV2X3BtX2RvbWFpbl9h dHRhY2ggZmFpbGVkICovCj4gPiArCQkJcmV0ID0gMDsKPiAKPiBBbiBlbHNlIHRoYXQgaGFzIGEg fSBzaG91bGQgYWxzbyBoYXZlIGEgeywgYWNjb3JkaW5nIHRvIAo+IGNoZWNrcGF0Y2ggYW5kIERv Y3VtZW50YXRpb24vQ29kaW5nU3R5bGUuIFlvdSBjYW4gd3JpdGUgaXQKPiBhbHRlcm5hdGl2ZWx5 IGFzOgo+IAo+IAlpZiAocmV0ICE9IC1FUFJPQkVfREVGRVIpIHsKPiAJCWlmIChkcnYtPnByb2Jl KQo+IAkJCXJldCA9IGRydi0+cHJvYmUoZGV2KTsKPiAJCWVsc2UKPiAJCQlyZXQgPSAwOwo+IAo+ IAkJaWYgKHJldCkKPiAJCQlkZXZfcG1fZG9tYWluX2RldGFjaChfZGV2LCB0cnVlKTsKPiAJfQo+ IAo+IC4KPiAKPiBCZXN0IHJlZ2FyZHMKPiBVd2UKPiAK -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | martin.wilck@ts.fujitsu.com |
|---|---|
| Date | 2015-11-30 13:00 +0100 |
| Subject | [PATCH v2] base/platform: return success when probe function is NULL |
| Message-ID | <qAvhE-38r-19@gated-at.bofh.it> |
| In reply to | #1278700 |
From: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
Since b8b2c7d845d5, platform_drv_probe() is called for all platform
devices. If drv->probe is NULL, and dev_pm_domain_attach() fails,
platform_drv_probe() will return the error code from dev_pm_domain_attach().
This causes real_probe() to enter the "probe_failed" path and set
dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume
success if both dev->bus->probe and drv->probe were missing. As a result,
a device and driver could be "bound" together just by matching their names;
this doesn't work any more after b8b2c7d845d5.
This may cause problems later for certain usage of platform_driver_register()
and platform_device_register_simple(). I observed a panic while loading
the tpm_tis driver with parameter "force=1" (i.e. registering tpm_tis as
a platform driver), because tpm_tis_init's assumption that the device
returned by platform_device_register_simple() was bound didn't hold any more
(tpmm_chip_alloc() dereferences chip->pdev->driver, causing panic).
This patch restores the previous (4.3.0 and earlier) behavior of
platform_drv_probe() in the case when the associated platform driver has
no "probe" function.
v2: fixed style issues, rephrased commit message.
Fixes: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain callbacks are called unconditionally")
Signed-off-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
---
drivers/base/platform.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 1dd6d3b..176b59f 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -513,10 +513,15 @@ static int platform_drv_probe(struct device *_dev)
return ret;
ret = dev_pm_domain_attach(_dev, true);
- if (ret != -EPROBE_DEFER && drv->probe) {
- ret = drv->probe(dev);
- if (ret)
- dev_pm_domain_detach(_dev, true);
+ if (ret != -EPROBE_DEFER) {
+ if (drv->probe) {
+ ret = drv->probe(dev);
+ if (ret)
+ dev_pm_domain_detach(_dev, true);
+ } else {
+ /* don't fail if just dev_pm_domain_attach failed */
+ ret = 0;
+ }
}
if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2015-11-28 17:40 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qzQHw-2L7-27@gated-at.bofh.it> |
| In reply to | #1278404 |
On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wilck@ts.fujitsu.com wrote:
> From: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
>
> Since b8b2c7d845d5, platform_drv_probe() is called for all platform
> devices. If drv->probe is NULL, and dev_pm_domain_attach() fails,
> platform_drv_probe() will return the error code from dev_pm_domain_attach().
>
> This causes real_probe() to enter the "probe_failed" path and set
> dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume
> success if both dev->bus->probe and drv->probe are missing.
>
> This may cause a panic later. For example, inserting the tpm_tis
> driver with parameter "force=1" (i.e. registering tpm_tis as a platform
> driver) will panic in tpmm_chip_alloc() because dev->driver is NULL:
>
> chip->cdev.owner = chip->pdev->driver->owner;
>
> This patch fixes this by returning success in platform_drv_probe() if
> "just" dev_pm_domain_attach() had failed. This restores the semantics
> of platform_device_register_XXX() if the associated platform driver has
> no "probe" function.
>
> Fixes: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain
> callbacks are called unconditionally")
>
> Signed-off-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
Acked-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
> drivers/base/platform.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 1dd6d3b..c994e76 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -513,10 +513,14 @@ static int platform_drv_probe(struct device *_dev)
> return ret;
>
> ret = dev_pm_domain_attach(_dev, true);
> - if (ret != -EPROBE_DEFER && drv->probe) {
> - ret = drv->probe(dev);
> - if (ret)
> - dev_pm_domain_detach(_dev, true);
> + if (ret != -EPROBE_DEFER) {
> + if (drv->probe) {
> + ret = drv->probe(dev);
> + if (ret)
> + dev_pm_domain_detach(_dev, true);
> + } else
> + /* don't fail if just dev_pm_domain_attach failed */
> + ret = 0;
> }
>
> if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
> --
> 1.8.3.1
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
|---|---|
| Date | 2015-11-29 11:00 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qA6VY-4y5-7@gated-at.bofh.it> |
| In reply to | #1279173 |
Hello Jarkko,
On Sat, Nov 28, 2015 at 06:34:47PM +0200, Jarkko Sakkinen wrote:
> On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wilck@ts.fujitsu.com wrote:
> > From: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
> >
> > Since b8b2c7d845d5, platform_drv_probe() is called for all platform
> > devices. If drv->probe is NULL, and dev_pm_domain_attach() fails,
> > platform_drv_probe() will return the error code from dev_pm_domain_attach().
> >
> > This causes real_probe() to enter the "probe_failed" path and set
> > dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume
> > success if both dev->bus->probe and drv->probe are missing.
> >
> > This may cause a panic later. For example, inserting the tpm_tis
> > driver with parameter "force=1" (i.e. registering tpm_tis as a platform
> > driver) will panic in tpmm_chip_alloc() because dev->driver is NULL:
> >
> > chip->cdev.owner = chip->pdev->driver->owner;
> >
> > This patch fixes this by returning success in platform_drv_probe() if
> > "just" dev_pm_domain_attach() had failed. This restores the semantics
> > of platform_device_register_XXX() if the associated platform driver has
> > no "probe" function.
> >
> > Fixes: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain
> > callbacks are called unconditionally")
> >
> > Signed-off-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
>
> Acked-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
While the patch is fine, the commit log is not. It blames b8b2c7d845d5
to be responsible for a panic, but in fact it only breaks the wrong
assumption of the tpm_tis driver.
So I'm not sure how to interpret your Ack, IMHO it should not make
gregkh pick up the patch as is.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2015-11-30 14:00 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qAwdI-3Lg-13@gated-at.bofh.it> |
| In reply to | #1279311 |
Hi Uwe,
On Sun, Nov 29, 2015 at 10:54:11AM +0100, Uwe Kleine-König wrote:
> Hello Jarkko,
>
> On Sat, Nov 28, 2015 at 06:34:47PM +0200, Jarkko Sakkinen wrote:
> > On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wilck@ts.fujitsu.com wrote:
> > > From: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
> > >
> > > Since b8b2c7d845d5, platform_drv_probe() is called for all platform
> > > devices. If drv->probe is NULL, and dev_pm_domain_attach() fails,
> > > platform_drv_probe() will return the error code from dev_pm_domain_attach().
> > >
> > > This causes real_probe() to enter the "probe_failed" path and set
> > > dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume
> > > success if both dev->bus->probe and drv->probe are missing.
> > >
> > > This may cause a panic later. For example, inserting the tpm_tis
> > > driver with parameter "force=1" (i.e. registering tpm_tis as a platform
> > > driver) will panic in tpmm_chip_alloc() because dev->driver is NULL:
> > >
> > > chip->cdev.owner = chip->pdev->driver->owner;
> > >
> > > This patch fixes this by returning success in platform_drv_probe() if
> > > "just" dev_pm_domain_attach() had failed. This restores the semantics
> > > of platform_device_register_XXX() if the associated platform driver has
> > > no "probe" function.
> > >
> > > Fixes: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain
> > > callbacks are called unconditionally")
> > >
> > > Signed-off-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
> >
> > Acked-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>
> While the patch is fine, the commit log is not. It blames b8b2c7d845d5
> to be responsible for a panic, but in fact it only breaks the wrong
> assumption of the tpm_tis driver.
>
> So I'm not sure how to interpret your Ack, IMHO it should not make
> gregkh pick up the patch as is.
Alright. I don't think you can speak about *wrong assumptions* if the
semantics allowed not to have it before. *Where* it should be fixed is
another question. I'd keep the Fixes tag in all cases.
Jason, you had the fix for this issue directly to tpm_tis driver that
you haven't yet posted, right? Just double-checking this.
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2015-11-30 14:10 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL |
| Message-ID | <qAwno-43R-7@gated-at.bofh.it> |
| In reply to | #1279844 |
On Mon, Nov 30, 2015 at 02:56:31PM +0200, Jarkko Sakkinen wrote:
> Hi Uwe,
>
> On Sun, Nov 29, 2015 at 10:54:11AM +0100, Uwe Kleine-König wrote:
> > Hello Jarkko,
> >
> > On Sat, Nov 28, 2015 at 06:34:47PM +0200, Jarkko Sakkinen wrote:
> > > On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wilck@ts.fujitsu.com wrote:
> > > > From: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
> > > >
> > > > Since b8b2c7d845d5, platform_drv_probe() is called for all platform
> > > > devices. If drv->probe is NULL, and dev_pm_domain_attach() fails,
> > > > platform_drv_probe() will return the error code from dev_pm_domain_attach().
> > > >
> > > > This causes real_probe() to enter the "probe_failed" path and set
> > > > dev->driver to NULL. Before b8b2c7d845d5, real_probe() would assume
> > > > success if both dev->bus->probe and drv->probe are missing.
> > > >
> > > > This may cause a panic later. For example, inserting the tpm_tis
> > > > driver with parameter "force=1" (i.e. registering tpm_tis as a platform
> > > > driver) will panic in tpmm_chip_alloc() because dev->driver is NULL:
> > > >
> > > > chip->cdev.owner = chip->pdev->driver->owner;
> > > >
> > > > This patch fixes this by returning success in platform_drv_probe() if
> > > > "just" dev_pm_domain_attach() had failed. This restores the semantics
> > > > of platform_device_register_XXX() if the associated platform driver has
> > > > no "probe" function.
> > > >
> > > > Fixes: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain
> > > > callbacks are called unconditionally")
> > > >
> > > > Signed-off-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
> > >
> > > Acked-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> >
> > While the patch is fine, the commit log is not. It blames b8b2c7d845d5
> > to be responsible for a panic, but in fact it only breaks the wrong
> > assumption of the tpm_tis driver.
> >
> > So I'm not sure how to interpret your Ack, IMHO it should not make
> > gregkh pick up the patch as is.
>
> Alright. I don't think you can speak about *wrong assumptions* if the
> semantics allowed not to have it before. *Where* it should be fixed is
> another question. I'd keep the Fixes tag in all cases.
>
> Jason, you had the fix for this issue directly to tpm_tis driver that
> you haven't yet posted, right? Just double-checking this.
Uwe, please ignore this :) Saw your more in-depth comment about platform
driver creation. Thank you. I somehow have missed it before.
/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web