Message ID | 20180407161236.22969-1-tomas.winkler@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > In crb_map_io() function, __crb_request_locality() is called prior > to crb_cmd_ready(), but if one of the consecutive function fails > the flow bails out instead of trying to relinquish locality. > This patch adds goto jump to __crb_relinquish_locality() on the error path. > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued only after granting > locality) > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > --- > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c > index 7f78482cd157..34fbc6cb097b 100644 > --- a/drivers/char/tpm/tpm_crb.c > +++ b/drivers/char/tpm/tpm_crb.c > @@ -511,8 +511,10 @@ static int crb_map_io(struct acpi_device *device, struct > crb_priv *priv, > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf->control_address, > sizeof(struct crb_regs_tail)); > - if (IS_ERR(priv->regs_t)) > - return PTR_ERR(priv->regs_t); > + if (IS_ERR(priv->regs_t)) { > + ret = PTR_ERR(priv->regs_t); > + goto out_relinquish_locality; > + } > > /* > * PTT HW bug w/a: wake up the device to access > @@ -520,7 +522,7 @@ static int crb_map_io(struct acpi_device *device, struct > crb_priv *priv, > */ > ret = crb_cmd_ready(dev, priv); > if (ret) > - return ret; > + goto out_relinquish_locality; > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device *device, struct > crb_priv *priv, > > crb_go_idle(dev, priv); > > +out_relinquish_locality: > + > __crb_relinquish_locality(dev, priv, 0); > > return ret; Thanks, please just call it before returning in the error path. /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PiANCj4gT24gU2F0LCAyMDE4LTA0LTA3IGF0IDE5OjEyICswMzAwLCBUb21hcyBXaW5rbGVyIHdy b3RlOg0KPiA+IEluIGNyYl9tYXBfaW8oKSBmdW5jdGlvbiwgX19jcmJfcmVxdWVzdF9sb2NhbGl0 eSgpIGlzIGNhbGxlZCBwcmlvciB0bw0KPiA+IGNyYl9jbWRfcmVhZHkoKSwgYnV0IGlmIG9uZSBv ZiB0aGUgY29uc2VjdXRpdmUgZnVuY3Rpb24gZmFpbHMgdGhlIGZsb3cNCj4gPiBiYWlscyBvdXQg aW5zdGVhZCBvZiB0cnlpbmcgdG8gcmVsaW5xdWlzaCBsb2NhbGl0eS4NCj4gPiBUaGlzIHBhdGNo IGFkZHMgZ290byBqdW1wIHRvIF9fY3JiX3JlbGlucXVpc2hfbG9jYWxpdHkoKSBvbiB0aGUgZXJy b3IgcGF0aC4NCj4gPg0KPiA+IEZpeGVzOiA4ODhkODY3ZGY0NDEgKHRwbTogY21kX3JlYWR5IGNv bW1hbmQgY2FuIGJlIGlzc3VlZCBvbmx5IGFmdGVyDQo+ID4gZ3JhbnRpbmcNCj4gPiBsb2NhbGl0 eSkNCj4gPiBTaWduZWQtb2ZmLWJ5OiBUb21hcyBXaW5rbGVyIDx0b21hcy53aW5rbGVyQGludGVs LmNvbT4NCj4gPiAtLS0NCj4gPiAgZHJpdmVycy9jaGFyL3RwbS90cG1fY3JiLmMgfCAxMCArKysr KysrLS0tDQo+ID4gIDEgZmlsZSBjaGFuZ2VkLCA3IGluc2VydGlvbnMoKyksIDMgZGVsZXRpb25z KC0pDQo+ID4NCj4gPiBkaWZmIC0tZ2l0IGEvZHJpdmVycy9jaGFyL3RwbS90cG1fY3JiLmMgYi9k cml2ZXJzL2NoYXIvdHBtL3RwbV9jcmIuYw0KPiA+IGluZGV4IDdmNzg0ODJjZDE1Ny4uMzRmYmM2 Y2IwOTdiIDEwMDY0NA0KPiA+IC0tLSBhL2RyaXZlcnMvY2hhci90cG0vdHBtX2NyYi5jDQo+ID4g KysrIGIvZHJpdmVycy9jaGFyL3RwbS90cG1fY3JiLmMNCj4gPiBAQCAtNTExLDggKzUxMSwxMCBA QCBzdGF0aWMgaW50IGNyYl9tYXBfaW8oc3RydWN0IGFjcGlfZGV2aWNlICpkZXZpY2UsDQo+ID4g c3RydWN0IGNyYl9wcml2ICpwcml2LA0KPiA+DQo+ID4gIAlwcml2LT5yZWdzX3QgPSBjcmJfbWFw X3JlcyhkZXYsIHByaXYsICZpb19yZXMsIGJ1Zi0+Y29udHJvbF9hZGRyZXNzLA0KPiA+ICAJCQkJ ICAgc2l6ZW9mKHN0cnVjdCBjcmJfcmVnc190YWlsKSk7DQo+ID4gLQlpZiAoSVNfRVJSKHByaXYt PnJlZ3NfdCkpDQo+ID4gLQkJcmV0dXJuIFBUUl9FUlIocHJpdi0+cmVnc190KTsNCj4gPiArCWlm IChJU19FUlIocHJpdi0+cmVnc190KSkgew0KPiA+ICsJCXJldCA9IFBUUl9FUlIocHJpdi0+cmVn c190KTsNCj4gPiArCQlnb3RvIG91dF9yZWxpbnF1aXNoX2xvY2FsaXR5Ow0KPiA+ICsJfQ0KPiA+ DQo+ID4gIAkvKg0KPiA+ICAJICogUFRUIEhXIGJ1ZyB3L2E6IHdha2UgdXAgdGhlIGRldmljZSB0 byBhY2Nlc3MgQEAgLTUyMCw3ICs1MjIsNw0KPiBAQA0KPiA+IHN0YXRpYyBpbnQgY3JiX21hcF9p byhzdHJ1Y3QgYWNwaV9kZXZpY2UgKmRldmljZSwgc3RydWN0IGNyYl9wcml2DQo+ID4gKnByaXYs DQo+ID4gIAkgKi8NCj4gPiAgCXJldCA9IGNyYl9jbWRfcmVhZHkoZGV2LCBwcml2KTsNCj4gPiAg CWlmIChyZXQpDQo+ID4gLQkJcmV0dXJuIHJldDsNCj4gPiArCQlnb3RvIG91dF9yZWxpbnF1aXNo X2xvY2FsaXR5Ow0KPiA+DQo+ID4gIAlwYV9oaWdoID0gaW9yZWFkMzIoJnByaXYtPnJlZ3NfdC0+ Y3RybF9jbWRfcGFfaGlnaCk7DQo+ID4gIAlwYV9sb3cgID0gaW9yZWFkMzIoJnByaXYtPnJlZ3Nf dC0+Y3RybF9jbWRfcGFfbG93KTsNCj4gPiBAQCAtNTY1LDYgKzU2Nyw4IEBAIHN0YXRpYyBpbnQg Y3JiX21hcF9pbyhzdHJ1Y3QgYWNwaV9kZXZpY2UgKmRldmljZSwNCj4gPiBzdHJ1Y3QgY3JiX3By aXYgKnByaXYsDQo+ID4NCj4gPiAgCWNyYl9nb19pZGxlKGRldiwgcHJpdik7DQo+ID4NCj4gPiAr b3V0X3JlbGlucXVpc2hfbG9jYWxpdHk6DQo+ID4gKw0KPiA+ICAJX19jcmJfcmVsaW5xdWlzaF9s b2NhbGl0eShkZXYsIHByaXYsIDApOw0KPiA+DQo+ID4gIAlyZXR1cm4gcmV0Ow0KPiANCj4gVGhh bmtzLCBwbGVhc2UganVzdCBjYWxsIGl0IGJlZm9yZSByZXR1cm5pbmcgaW4gdGhlIGVycm9yIHBh dGguDQoNCkNhbiB5b3UgcGxlYXNlIGVsYWJvcmF0ZSB3aHksIGlzbid0IHRoZSBjZW50cmFsaXpl ZCBleGl0aW5nIG9mIGZ1bmN0aW9ucyBwcmVmZXJyZWQga2VybmVsIGNvZGluZyBzdHlsZT8gDQpo dHRwczovL3d3dy5rZXJuZWwub3JnL2RvYy9odG1sL3Y0LjExL3Byb2Nlc3MvY29kaW5nLXN0eWxl Lmh0bWwjY2VudHJhbGl6ZWQtZXhpdGluZy1vZi1mdW5jdGlvbnMgDQoNClRoYW5rcw0KVG9tYXMN Cg0KPiANCj4gL0phcmtrbw0K -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > In crb_map_io() function, __crb_request_locality() is called prior to > > > crb_cmd_ready(), but if one of the consecutive function fails the flow > > > bails out instead of trying to relinquish locality. > > > This patch adds goto jump to __crb_relinquish_locality() on the error > > > path. > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued only after > > > granting > > > locality) > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > --- > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c > > > index 7f78482cd157..34fbc6cb097b 100644 > > > --- a/drivers/char/tpm/tpm_crb.c > > > +++ b/drivers/char/tpm/tpm_crb.c > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct acpi_device *device, > > > struct crb_priv *priv, > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > >control_address, > > > sizeof(struct crb_regs_tail)); > > > - if (IS_ERR(priv->regs_t)) > > > - return PTR_ERR(priv->regs_t); > > > + if (IS_ERR(priv->regs_t)) { > > > + ret = PTR_ERR(priv->regs_t); > > > + goto out_relinquish_locality; > > > + } > > > > > > /* > > > * PTT HW bug w/a: wake up the device to access @@ -520,7 +522,7 > > > > @@ > > > static int crb_map_io(struct acpi_device *device, struct crb_priv > > > *priv, > > > */ > > > ret = crb_cmd_ready(dev, priv); > > > if (ret) > > > - return ret; > > > + goto out_relinquish_locality; > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device *device, > > > struct crb_priv *priv, > > > > > > crb_go_idle(dev, priv); > > > > > > +out_relinquish_locality: > > > + > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > return ret; > > > > Thanks, please just call it before returning in the error path. > > Can you please elaborate why, isn't the centralized exiting of functions > preferred kernel coding style? > https://www.kernel.org/doc/html/v4.11/process/coding-style.html#centralized-ex > iting-of-functions You exit only from one location (not multiple) and not from a nested context. Here you just add more complexity by doing this. /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > In crb_map_io() function, __crb_request_locality() is called prior > > > > to crb_cmd_ready(), but if one of the consecutive function fails > > > > the flow bails out instead of trying to relinquish locality. > > > > This patch adds goto jump to __crb_relinquish_locality() on the > > > > error path. > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued only > > > > after granting > > > > locality) > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > --- > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > b/drivers/char/tpm/tpm_crb.c index 7f78482cd157..34fbc6cb097b > > > > 100644 > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct acpi_device > > > > *device, struct crb_priv *priv, > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > >control_address, > > > > sizeof(struct crb_regs_tail)); > > > > - if (IS_ERR(priv->regs_t)) > > > > - return PTR_ERR(priv->regs_t); > > > > + if (IS_ERR(priv->regs_t)) { > > > > + ret = PTR_ERR(priv->regs_t); > > > > + goto out_relinquish_locality; > > > > + } > > > > > > > > /* > > > > * PTT HW bug w/a: wake up the device to access @@ -520,7 +522,7 > > > > > > @@ > > > > static int crb_map_io(struct acpi_device *device, struct crb_priv > > > > *priv, > > > > */ > > > > ret = crb_cmd_ready(dev, priv); > > > > if (ret) > > > > - return ret; > > > > + goto out_relinquish_locality; > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device > > > > *device, struct crb_priv *priv, > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > +out_relinquish_locality: > > > > + > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > return ret; > > > > > > Thanks, please just call it before returning in the error path. > > > > Can you please elaborate why, isn't the centralized exiting of > > functions preferred kernel coding style? > > https://www.kernel.org/doc/html/v4.11/process/coding-style.html#centra > > lized-ex > > iting-of-functions > > You exit only from one location (not multiple) and not from a nested > context. Here you just add more complexity by doing this. Where is the complexitity ? I see it as a standard way of undoing on exit. Tomas
> > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > In crb_map_io() function, __crb_request_locality() is called > > > > > prior to crb_cmd_ready(), but if one of the consecutive function > > > > > fails the flow bails out instead of trying to relinquish locality. > > > > > This patch adds goto jump to __crb_relinquish_locality() on the > > > > > error path. > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued only > > > > > after granting > > > > > locality) > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > > --- > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > b/drivers/char/tpm/tpm_crb.c index 7f78482cd157..34fbc6cb097b > > > > > 100644 > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct acpi_device > > > > > *device, struct crb_priv *priv, > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > > >control_address, > > > > > sizeof(struct crb_regs_tail)); > > > > > - if (IS_ERR(priv->regs_t)) > > > > > - return PTR_ERR(priv->regs_t); > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > + goto out_relinquish_locality; > > > > > + } > > > > > > > > > > /* > > > > > * PTT HW bug w/a: wake up the device to access @@ -520,7 > > > > > +522,7 > > > > > > > > @@ > > > > > static int crb_map_io(struct acpi_device *device, struct > > > > > crb_priv *priv, > > > > > */ > > > > > ret = crb_cmd_ready(dev, priv); > > > > > if (ret) > > > > > - return ret; > > > > > + goto out_relinquish_locality; > > > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device > > > > > *device, struct crb_priv *priv, > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > +out_relinquish_locality: > > > > > + > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > return ret; > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > Can you please elaborate why, isn't the centralized exiting of > > > functions preferred kernel coding style? > > > https://www.kernel.org/doc/html/v4.11/process/coding-style.html#cent > > > ra > > > lized-ex > > > iting-of-functions > > > > You exit only from one location (not multiple) and not from a nested > > context. Here you just add more complexity by doing this. > > Where is the complexity ? I see it as a standard way of undoing on exit. > Tomas Jarkko, can you please respond. Thanks Tomas
On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > In crb_map_io() function, __crb_request_locality() is called > > > > > > prior to crb_cmd_ready(), but if one of the consecutive function > > > > > > fails the flow bails out instead of trying to relinquish locality. > > > > > > This patch adds goto jump to __crb_relinquish_locality() on the > > > > > > error path. > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued only > > > > > > after granting > > > > > > locality) > > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > > > --- > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > b/drivers/char/tpm/tpm_crb.c index 7f78482cd157..34fbc6cb097b > > > > > > 100644 > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct acpi_device > > > > > > *device, struct crb_priv *priv, > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > > > >control_address, > > > > > > sizeof(struct crb_regs_tail)); > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > + goto out_relinquish_locality; > > > > > > + } > > > > > > > > > > > > /* > > > > > > * PTT HW bug w/a: wake up the device to access @@ -520,7 > > > > > > +522,7 > > > > > > > > > > @@ > > > > > > static int crb_map_io(struct acpi_device *device, struct > > > > > > crb_priv *priv, > > > > > > */ > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > if (ret) > > > > > > - return ret; > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device > > > > > > *device, struct crb_priv *priv, > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > +out_relinquish_locality: > > > > > > + > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > return ret; > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > Can you please elaborate why, isn't the centralized exiting of > > > > functions preferred kernel coding style? > > > > https://www.kernel.org/doc/html/v4.11/process/coding-style.html#cent > > > > ra > > > > lized-ex > > > > iting-of-functions > > > > > > You exit only from one location (not multiple) and not from a nested > > > context. Here you just add more complexity by doing this. > > > > Where is the complexity ? I see it as a standard way of undoing on exit. > > Tomas > > Jarkko, can you please respond. > Thanks > Tomas I was away for Mon-Wed last week and did not work on TPM for Thu-Fri. My earlier comment was incorrect as there are two locations to exit (not sure how I managed to overlook the patch that way). Thus, I have only two very minor requets: * Remove the extra newline (the last line addition in the patch). * Use just label named out as we have only one exception handler. I'll move on to testing, and if it it passes, I can do those updates myself. /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 24, 2018 at 07:03:28PM +0300, Jarkko Sakkinen wrote: > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > In crb_map_io() function, __crb_request_locality() is called > > > > > > > prior to crb_cmd_ready(), but if one of the consecutive function > > > > > > > fails the flow bails out instead of trying to relinquish locality. > > > > > > > This patch adds goto jump to __crb_relinquish_locality() on the > > > > > > > error path. > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued only > > > > > > > after granting > > > > > > > locality) > > > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > > > > --- > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > b/drivers/char/tpm/tpm_crb.c index 7f78482cd157..34fbc6cb097b > > > > > > > 100644 > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct acpi_device > > > > > > > *device, struct crb_priv *priv, > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > > > > >control_address, > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > + goto out_relinquish_locality; > > > > > > > + } > > > > > > > > > > > > > > /* > > > > > > > * PTT HW bug w/a: wake up the device to access @@ -520,7 > > > > > > > +522,7 > > > > > > > > > > > > @@ > > > > > > > static int crb_map_io(struct acpi_device *device, struct > > > > > > > crb_priv *priv, > > > > > > > */ > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > if (ret) > > > > > > > - return ret; > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device > > > > > > > *device, struct crb_priv *priv, > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > + > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > > > Can you please elaborate why, isn't the centralized exiting of > > > > > functions preferred kernel coding style? > > > > > https://www.kernel.org/doc/html/v4.11/process/coding-style.html#cent > > > > > ra > > > > > lized-ex > > > > > iting-of-functions > > > > > > > > You exit only from one location (not multiple) and not from a nested > > > > context. Here you just add more complexity by doing this. > > > > > > Where is the complexity ? I see it as a standard way of undoing on exit. > > > Tomas > > > > Jarkko, can you please respond. > > Thanks > > Tomas > > I was away for Mon-Wed last week and did not work on TPM for Thu-Fri. > > My earlier comment was incorrect as there are two locations to exit (not > sure how I managed to overlook the patch that way). > > Thus, I have only two very minor requets: > > * Remove the extra newline (the last line addition in the patch). > * Use just label named out as we have only one exception handler. > > I'll move on to testing, and if it it passes, I can do those updates > myself. > > /Jarkko Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> Subject: Re: [PATCH] tpm: tpm_crb: relinquish locality on error path. > > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > In crb_map_io() function, __crb_request_locality() is called > > > > > > > prior to crb_cmd_ready(), but if one of the consecutive > > > > > > > function fails the flow bails out instead of trying to relinquish > locality. > > > > > > > This patch adds goto jump to __crb_relinquish_locality() on > > > > > > > the error path. > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued > > > > > > > only after granting > > > > > > > locality) > > > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > > > > --- > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > b/drivers/char/tpm/tpm_crb.c index > > > > > > > 7f78482cd157..34fbc6cb097b > > > > > > > 100644 > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > > > > >control_address, > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > + goto out_relinquish_locality; > > > > > > > + } > > > > > > > > > > > > > > /* > > > > > > > * PTT HW bug w/a: wake up the device to access @@ -520,7 > > > > > > > +522,7 > > > > > > > > > > > > @@ > > > > > > > static int crb_map_io(struct acpi_device *device, struct > > > > > > > crb_priv *priv, > > > > > > > */ > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > if (ret) > > > > > > > - return ret; > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device > > > > > > > *device, struct crb_priv *priv, > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > + > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > > > Can you please elaborate why, isn't the centralized exiting of > > > > > functions preferred kernel coding style? > > > > > https://www.kernel.org/doc/html/v4.11/process/coding-style.html# > > > > > cent > > > > > ra > > > > > lized-ex > > > > > iting-of-functions > > > > > > > > You exit only from one location (not multiple) and not from a > > > > nested context. Here you just add more complexity by doing this. > > > > > > Where is the complexity ? I see it as a standard way of undoing on exit. > > > Tomas > > > > Jarkko, can you please respond. > > Thanks > > Tomas > > I was away for Mon-Wed last week and did not work on TPM for Thu-Fri. > > My earlier comment was incorrect as there are two locations to exit (not > sure how I managed to overlook the patch that way). > > Thus, I have only two very minor requets: > > * Remove the extra newline (the last line addition in the patch). Okay > * Use just label named out as we have only one exception handler. Cannot do that, as the bail out is prior to cmd_ready request so there is no need for go_idle which is under out label. > > I'll move on to testing, and if it it passes, I can do those updates myself. Thanks, I prefer to resend myself. Tomas -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> On Tue, Apr 24, 2018 at 07:03:28PM +0300, Jarkko Sakkinen wrote: > > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > > In crb_map_io() function, __crb_request_locality() is > > > > > > > > called prior to crb_cmd_ready(), but if one of the > > > > > > > > consecutive function fails the flow bails out instead of trying to > relinquish locality. > > > > > > > > This patch adds goto jump to __crb_relinquish_locality() > > > > > > > > on the error path. > > > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued > > > > > > > > only after granting > > > > > > > > locality) > > > > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > > > > > --- > > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > > b/drivers/char/tpm/tpm_crb.c index > > > > > > > > 7f78482cd157..34fbc6cb097b > > > > > > > > 100644 > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > > > > > >control_address, > > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > > + goto out_relinquish_locality; > > > > > > > > + } > > > > > > > > > > > > > > > > /* > > > > > > > > * PTT HW bug w/a: wake up the device to access @@ > > > > > > > > -520,7 > > > > > > > > +522,7 > > > > > > > > > > > > > > @@ > > > > > > > > static int crb_map_io(struct acpi_device *device, struct > > > > > > > > crb_priv *priv, > > > > > > > > */ > > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > > if (ret) > > > > > > > > - return ret; > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > > + > > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > > > > > Can you please elaborate why, isn't the centralized exiting of > > > > > > functions preferred kernel coding style? > > > > > > https://www.kernel.org/doc/html/v4.11/process/coding-style.htm > > > > > > l#cent > > > > > > ra > > > > > > lized-ex > > > > > > iting-of-functions > > > > > > > > > > You exit only from one location (not multiple) and not from a > > > > > nested context. Here you just add more complexity by doing this. > > > > > > > > Where is the complexity ? I see it as a standard way of undoing on exit. > > > > Tomas > > > > > > Jarkko, can you please respond. > > > Thanks > > > Tomas > > > > I was away for Mon-Wed last week and did not work on TPM for Thu-Fri. > > > > My earlier comment was incorrect as there are two locations to exit > > (not sure how I managed to overlook the patch that way). > > > > Thus, I have only two very minor requets: > > > > * Remove the extra newline (the last line addition in the patch). > > * Use just label named out as we have only one exception handler. > > > > I'll move on to testing, and if it it passes, I can do those updates > > myself. > > > > /Jarkko > > Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > Thanks Tomas -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 24, 2018 at 08:04:01PM +0000, Winkler, Tomas wrote: > > Subject: Re: [PATCH] tpm: tpm_crb: relinquish locality on error path. > > > > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > > In crb_map_io() function, __crb_request_locality() is called > > > > > > > > prior to crb_cmd_ready(), but if one of the consecutive > > > > > > > > function fails the flow bails out instead of trying to relinquish > > locality. > > > > > > > > This patch adds goto jump to __crb_relinquish_locality() on > > > > > > > > the error path. > > > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be issued > > > > > > > > only after granting > > > > > > > > locality) > > > > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > > > > > --- > > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > > b/drivers/char/tpm/tpm_crb.c index > > > > > > > > 7f78482cd157..34fbc6cb097b > > > > > > > > 100644 > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > > > > > >control_address, > > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > > + goto out_relinquish_locality; > > > > > > > > + } > > > > > > > > > > > > > > > > /* > > > > > > > > * PTT HW bug w/a: wake up the device to access @@ -520,7 > > > > > > > > +522,7 > > > > > > > > > > > > > > @@ > > > > > > > > static int crb_map_io(struct acpi_device *device, struct > > > > > > > > crb_priv *priv, > > > > > > > > */ > > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > > if (ret) > > > > > > > > - return ret; > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device > > > > > > > > *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > > + > > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > > > > > Can you please elaborate why, isn't the centralized exiting of > > > > > > functions preferred kernel coding style? > > > > > > https://www.kernel.org/doc/html/v4.11/process/coding-style.html# > > > > > > cent > > > > > > ra > > > > > > lized-ex > > > > > > iting-of-functions > > > > > > > > > > You exit only from one location (not multiple) and not from a > > > > > nested context. Here you just add more complexity by doing this. > > > > > > > > Where is the complexity ? I see it as a standard way of undoing on exit. > > > > Tomas > > > > > > Jarkko, can you please respond. > > > Thanks > > > Tomas > > > > I was away for Mon-Wed last week and did not work on TPM for Thu-Fri. > > > > My earlier comment was incorrect as there are two locations to exit (not > > sure how I managed to overlook the patch that way). > > > > Thus, I have only two very minor requets: > > > > * Remove the extra newline (the last line addition in the patch). > Okay > > * Use just label named out as we have only one exception handler. > Cannot do that, as the bail out is prior to cmd_ready request so there is no need for go_idle which is under out label. > > > > I'll move on to testing, and if it it passes, I can do those updates myself. > Thanks, I prefer to resend myself. > > Tomas Add my tested-by as it is cosmectic change, thanks. /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> > On Tue, Apr 24, 2018 at 08:04:01PM +0000, Winkler, Tomas wrote: > > > Subject: Re: [PATCH] tpm: tpm_crb: relinquish locality on error path. > > > > > > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > > > In crb_map_io() function, __crb_request_locality() is > > > > > > > > > called prior to crb_cmd_ready(), but if one of the > > > > > > > > > consecutive function fails the flow bails out instead of > > > > > > > > > trying to relinquish > > > locality. > > > > > > > > > This patch adds goto jump to __crb_relinquish_locality() > > > > > > > > > on the error path. > > > > > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be > > > > > > > > > issued only after granting > > > > > > > > > locality) > > > > > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > > > > > > --- > > > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > > > b/drivers/char/tpm/tpm_crb.c index > > > > > > > > > 7f78482cd157..34fbc6cb097b > > > > > > > > > 100644 > > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > > > > > > >control_address, > > > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > + } > > > > > > > > > > > > > > > > > > /* > > > > > > > > > * PTT HW bug w/a: wake up the device to access @@ > > > > > > > > > -520,7 > > > > > > > > > +522,7 > > > > > > > > > > > > > > > > @@ > > > > > > > > > static int crb_map_io(struct acpi_device *device, struct > > > > > > > > > crb_priv *priv, > > > > > > > > > */ > > > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > > > if (ret) > > > > > > > > > - return ret; > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > > > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > > > + > > > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > > > > > > > Can you please elaborate why, isn't the centralized exiting > > > > > > > of functions preferred kernel coding style? > > > > > > > https://www.kernel.org/doc/html/v4.11/process/coding-style.h > > > > > > > tml# > > > > > > > cent > > > > > > > ra > > > > > > > lized-ex > > > > > > > iting-of-functions > > > > > > > > > > > > You exit only from one location (not multiple) and not from a > > > > > > nested context. Here you just add more complexity by doing this. > > > > > > > > > > Where is the complexity ? I see it as a standard way of undoing on > exit. > > > > > Tomas > > > > > > > > Jarkko, can you please respond. > > > > Thanks > > > > Tomas > > > > > > I was away for Mon-Wed last week and did not work on TPM for Thu-Fri. > > > > > > My earlier comment was incorrect as there are two locations to exit > > > (not sure how I managed to overlook the patch that way). > > > > > > Thus, I have only two very minor requets: > > > > > > * Remove the extra newline (the last line addition in the patch). > > Okay > > > * Use just label named out as we have only one exception handler. > > Cannot do that, as the bail out is prior to cmd_ready request so there is no > need for go_idle which is under out label. > > > > > > I'll move on to testing, and if it it passes, I can do those updates myself. > > Thanks, I prefer to resend myself. > > > > Tomas > > Add my tested-by as it is cosmectic change, thanks. What change exactly? I had impression you've accepted the patch as is? Thanks Tomas -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, May 02, 2018 at 01:35:47PM +0000, Winkler, Tomas wrote: > > > > > > On Tue, Apr 24, 2018 at 08:04:01PM +0000, Winkler, Tomas wrote: > > > > Subject: Re: [PATCH] tpm: tpm_crb: relinquish locality on error path. > > > > > > > > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > > > > In crb_map_io() function, __crb_request_locality() is > > > > > > > > > > called prior to crb_cmd_ready(), but if one of the > > > > > > > > > > consecutive function fails the flow bails out instead of > > > > > > > > > > trying to relinquish > > > > locality. > > > > > > > > > > This patch adds goto jump to __crb_relinquish_locality() > > > > > > > > > > on the error path. > > > > > > > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be > > > > > > > > > > issued only after granting > > > > > > > > > > locality) > > > > > > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > > > > > > > > > > --- > > > > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > > > > b/drivers/char/tpm/tpm_crb.c index > > > > > > > > > > 7f78482cd157..34fbc6cb097b > > > > > > > > > > 100644 > > > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct > > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, buf- > > > > > > > > > > >control_address, > > > > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > + } > > > > > > > > > > > > > > > > > > > > /* > > > > > > > > > > * PTT HW bug w/a: wake up the device to access @@ > > > > > > > > > > -520,7 > > > > > > > > > > +522,7 > > > > > > > > > > > > > > > > > > @@ > > > > > > > > > > static int crb_map_io(struct acpi_device *device, struct > > > > > > > > > > crb_priv *priv, > > > > > > > > > > */ > > > > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > > > > if (ret) > > > > > > > > > > - return ret; > > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); > > > > > > > > > > pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct > > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > > > > + > > > > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > > > > > > > > > Can you please elaborate why, isn't the centralized exiting > > > > > > > > of functions preferred kernel coding style? > > > > > > > > https://www.kernel.org/doc/html/v4.11/process/coding-style.h > > > > > > > > tml# > > > > > > > > cent > > > > > > > > ra > > > > > > > > lized-ex > > > > > > > > iting-of-functions > > > > > > > > > > > > > > You exit only from one location (not multiple) and not from a > > > > > > > nested context. Here you just add more complexity by doing this. > > > > > > > > > > > > Where is the complexity ? I see it as a standard way of undoing on > > exit. > > > > > > Tomas > > > > > > > > > > Jarkko, can you please respond. > > > > > Thanks > > > > > Tomas > > > > > > > > I was away for Mon-Wed last week and did not work on TPM for Thu-Fri. > > > > > > > > My earlier comment was incorrect as there are two locations to exit > > > > (not sure how I managed to overlook the patch that way). > > > > > > > > Thus, I have only two very minor requets: > > > > > > > > * Remove the extra newline (the last line addition in the patch). > > > Okay > > > > * Use just label named out as we have only one exception handler. > > > Cannot do that, as the bail out is prior to cmd_ready request so there is no > > need for go_idle which is under out label. > > > > > > > > I'll move on to testing, and if it it passes, I can do those updates myself. > > > Thanks, I prefer to resend myself. > > > > > > Tomas > > > > Add my tested-by as it is cosmectic change, thanks. > > > What change exactly? I had impression you've accepted the patch as is? > Thanks > Tomas Hmm... maybe there is some misunderstandig but I thought you were going to make the updates above yourself and send a revised patch. /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> > > > > > > > On Tue, Apr 24, 2018 at 08:04:01PM +0000, Winkler, Tomas wrote: > > > > > Subject: Re: [PATCH] tpm: tpm_crb: relinquish locality on error path. > > > > > > > > > > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > > > > > In crb_map_io() function, __crb_request_locality() > > > > > > > > > > > is called prior to crb_cmd_ready(), but if one of > > > > > > > > > > > the consecutive function fails the flow bails out > > > > > > > > > > > instead of trying to relinquish > > > > > locality. > > > > > > > > > > > This patch adds goto jump to > > > > > > > > > > > __crb_relinquish_locality() on the error path. > > > > > > > > > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be > > > > > > > > > > > issued only after granting > > > > > > > > > > > locality) > > > > > > > > > > > Signed-off-by: Tomas Winkler > > > > > > > > > > > <tomas.winkler@intel.com> > > > > > > > > > > > --- > > > > > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > b/drivers/char/tpm/tpm_crb.c index > > > > > > > > > > > 7f78482cd157..34fbc6cb097b > > > > > > > > > > > 100644 > > > > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct > > > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, > > > > > > > > > > > buf- > > > > > > > > > > > >control_address, > > > > > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > + } > > > > > > > > > > > > > > > > > > > > > > /* > > > > > > > > > > > * PTT HW bug w/a: wake up the device to access > @@ > > > > > > > > > > > -520,7 > > > > > > > > > > > +522,7 > > > > > > > > > > > > > > > > > > > > @@ > > > > > > > > > > > static int crb_map_io(struct acpi_device *device, > > > > > > > > > > > struct crb_priv *priv, > > > > > > > > > > > */ > > > > > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > > > > > if (ret) > > > > > > > > > > > - return ret; > > > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t- > >ctrl_cmd_pa_high); > > > > > > > > > > > pa_low = > > > > > > > > > > > ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct > > > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > > > > > + > > > > > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > > > > > > > > > > > Can you please elaborate why, isn't the centralized > > > > > > > > > exiting of functions preferred kernel coding style? > > > > > > > > > https://www.kernel.org/doc/html/v4.11/process/coding-sty > > > > > > > > > le.h > > > > > > > > > tml# > > > > > > > > > cent > > > > > > > > > ra > > > > > > > > > lized-ex > > > > > > > > > iting-of-functions > > > > > > > > > > > > > > > > You exit only from one location (not multiple) and not > > > > > > > > from a nested context. Here you just add more complexity by > doing this. > > > > > > > > > > > > > > Where is the complexity ? I see it as a standard way of > > > > > > > undoing on > > > exit. > > > > > > > Tomas > > > > > > > > > > > > Jarkko, can you please respond. > > > > > > Thanks > > > > > > Tomas > > > > > > > > > > I was away for Mon-Wed last week and did not work on TPM for Thu- > Fri. > > > > > > > > > > My earlier comment was incorrect as there are two locations to > > > > > exit (not sure how I managed to overlook the patch that way). > > > > > > > > > > Thus, I have only two very minor requets: > > > > > > > > > > * Remove the extra newline (the last line addition in the patch). > > > > Okay > > > > > * Use just label named out as we have only one exception handler. > > > > Cannot do that, as the bail out is prior to cmd_ready request so > > > > there is no > > > need for go_idle which is under out label. > > > > > > > > > > I'll move on to testing, and if it it passes, I can do those updates > myself. > > > > Thanks, I prefer to resend myself. > > > > > > > > Tomas > > > > > > Add my tested-by as it is cosmectic change, thanks. > > > > > > What change exactly? I had impression you've accepted the patch as is? > > Thanks > > Tomas > > Hmm... maybe there is some misunderstandig but I thought you were going > to make the updates above yourself and send a revised patch. Probably, if I remember there were to mails going in asynchronous, I've received your tested-by, the second I've sent this answer, so I thought you came to the conclusion that there is nothing to change in the patch yourself. Frankly I've checked the patch and there are no even extra new lines in my version unless it has scrambled on the way. Thanks Tomas -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, May 03, 2018 at 06:42:26AM +0000, Winkler, Tomas wrote: > > > > > > > > > > > > On Tue, Apr 24, 2018 at 08:04:01PM +0000, Winkler, Tomas wrote: > > > > > > Subject: Re: [PATCH] tpm: tpm_crb: relinquish locality on error path. > > > > > > > > > > > > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > > > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > > > > > > In crb_map_io() function, __crb_request_locality() > > > > > > > > > > > > is called prior to crb_cmd_ready(), but if one of > > > > > > > > > > > > the consecutive function fails the flow bails out > > > > > > > > > > > > instead of trying to relinquish > > > > > > locality. > > > > > > > > > > > > This patch adds goto jump to > > > > > > > > > > > > __crb_relinquish_locality() on the error path. > > > > > > > > > > > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can be > > > > > > > > > > > > issued only after granting > > > > > > > > > > > > locality) > > > > > > > > > > > > Signed-off-by: Tomas Winkler > > > > > > > > > > > > <tomas.winkler@intel.com> > > > > > > > > > > > > --- > > > > > > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > > b/drivers/char/tpm/tpm_crb.c index > > > > > > > > > > > > 7f78482cd157..34fbc6cb097b > > > > > > > > > > > > 100644 > > > > > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > > @@ -511,8 +511,10 @@ static int crb_map_io(struct > > > > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, > > > > > > > > > > > > buf- > > > > > > > > > > > > >control_address, > > > > > > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > + } > > > > > > > > > > > > > > > > > > > > > > > > /* > > > > > > > > > > > > * PTT HW bug w/a: wake up the device to access > > @@ > > > > > > > > > > > > -520,7 > > > > > > > > > > > > +522,7 > > > > > > > > > > > > > > > > > > > > > > @@ > > > > > > > > > > > > static int crb_map_io(struct acpi_device *device, > > > > > > > > > > > > struct crb_priv *priv, > > > > > > > > > > > > */ > > > > > > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > > > > > > if (ret) > > > > > > > > > > > > - return ret; > > > > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t- > > >ctrl_cmd_pa_high); > > > > > > > > > > > > pa_low = > > > > > > > > > > > > ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct > > > > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > > > > > > + > > > > > > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > > > > > > > > > > > Thanks, please just call it before returning in the error path. > > > > > > > > > > > > > > > > > > > > Can you please elaborate why, isn't the centralized > > > > > > > > > > exiting of functions preferred kernel coding style? > > > > > > > > > > https://www.kernel.org/doc/html/v4.11/process/coding-sty > > > > > > > > > > le.h > > > > > > > > > > tml# > > > > > > > > > > cent > > > > > > > > > > ra > > > > > > > > > > lized-ex > > > > > > > > > > iting-of-functions > > > > > > > > > > > > > > > > > > You exit only from one location (not multiple) and not > > > > > > > > > from a nested context. Here you just add more complexity by > > doing this. > > > > > > > > > > > > > > > > Where is the complexity ? I see it as a standard way of > > > > > > > > undoing on > > > > exit. > > > > > > > > Tomas > > > > > > > > > > > > > > Jarkko, can you please respond. > > > > > > > Thanks > > > > > > > Tomas > > > > > > > > > > > > I was away for Mon-Wed last week and did not work on TPM for Thu- > > Fri. > > > > > > > > > > > > My earlier comment was incorrect as there are two locations to > > > > > > exit (not sure how I managed to overlook the patch that way). > > > > > > > > > > > > Thus, I have only two very minor requets: > > > > > > > > > > > > * Remove the extra newline (the last line addition in the patch). > > > > > Okay > > > > > > * Use just label named out as we have only one exception handler. > > > > > Cannot do that, as the bail out is prior to cmd_ready request so > > > > > there is no > > > > need for go_idle which is under out label. > > > > > > > > > > > > I'll move on to testing, and if it it passes, I can do those updates > > myself. > > > > > Thanks, I prefer to resend myself. > > > > > > > > > > Tomas > > > > > > > > Add my tested-by as it is cosmectic change, thanks. > > > > > > > > > What change exactly? I had impression you've accepted the patch as is? > > > Thanks > > > Tomas > > > > Hmm... maybe there is some misunderstandig but I thought you were going > > to make the updates above yourself and send a revised patch. > > > Probably, if I remember there were to mails going in asynchronous, I've received your tested-by, the second I've sent this answer, > so I thought you came to the conclusion that there is nothing to change in the patch yourself. > Frankly I've checked the patch and there are no even extra new lines in my version unless it has scrambled on the way. > > Thanks > Tomas The only thing was the label name. That is why I asked if I can change it by myself instead of you having to send a follow up patch. Did you send a new one? Did not find it from patchwork. /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> > On Thu, May 03, 2018 at 06:42:26AM +0000, Winkler, Tomas wrote: > > > > > > > > > > > > > > > > On Tue, Apr 24, 2018 at 08:04:01PM +0000, Winkler, Tomas wrote: > > > > > > > Subject: Re: [PATCH] tpm: tpm_crb: relinquish locality on error > path. > > > > > > > > > > > > > > On Fri, Apr 20, 2018 at 01:19:12PM +0000, Winkler, Tomas wrote: > > > > > > > > > > On Tue, 2018-04-10 at 09:00 +0000, Winkler, Tomas wrote: > > > > > > > > > > > > > > > > > > > > > > > > On Sat, 2018-04-07 at 19:12 +0300, Tomas Winkler wrote: > > > > > > > > > > > > > In crb_map_io() function, > > > > > > > > > > > > > __crb_request_locality() is called prior to > > > > > > > > > > > > > crb_cmd_ready(), but if one of the consecutive > > > > > > > > > > > > > function fails the flow bails out instead of > > > > > > > > > > > > > trying to relinquish > > > > > > > locality. > > > > > > > > > > > > > This patch adds goto jump to > > > > > > > > > > > > > __crb_relinquish_locality() on the error path. > > > > > > > > > > > > > > > > > > > > > > > > > > Fixes: 888d867df441 (tpm: cmd_ready command can > > > > > > > > > > > > > be issued only after granting > > > > > > > > > > > > > locality) > > > > > > > > > > > > > Signed-off-by: Tomas Winkler > > > > > > > > > > > > > <tomas.winkler@intel.com> > > > > > > > > > > > > > --- > > > > > > > > > > > > > drivers/char/tpm/tpm_crb.c | 10 +++++++--- > > > > > > > > > > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > > > b/drivers/char/tpm/tpm_crb.c index > > > > > > > > > > > > > 7f78482cd157..34fbc6cb097b > > > > > > > > > > > > > 100644 > > > > > > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > > > > > > > > @@ -511,8 +511,10 @@ static int > > > > > > > > > > > > > crb_map_io(struct acpi_device *device, struct > > > > > > > > > > > > > crb_priv *priv, > > > > > > > > > > > > > > > > > > > > > > > > > > priv->regs_t = crb_map_res(dev, priv, &io_res, > > > > > > > > > > > > > buf- > > > > > > > > > > > > > >control_address, > > > > > > > > > > > > > sizeof(struct crb_regs_tail)); > > > > > > > > > > > > > - if (IS_ERR(priv->regs_t)) > > > > > > > > > > > > > - return PTR_ERR(priv->regs_t); > > > > > > > > > > > > > + if (IS_ERR(priv->regs_t)) { > > > > > > > > > > > > > + ret = PTR_ERR(priv->regs_t); > > > > > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > + } > > > > > > > > > > > > > > > > > > > > > > > > > > /* > > > > > > > > > > > > > * PTT HW bug w/a: wake up the device to > > > > > > > > > > > > > access > > > @@ > > > > > > > > > > > > > -520,7 > > > > > > > > > > > > > +522,7 > > > > > > > > > > > > > > > > > > > > > > > > @@ > > > > > > > > > > > > > static int crb_map_io(struct acpi_device > > > > > > > > > > > > > *device, struct crb_priv *priv, > > > > > > > > > > > > > */ > > > > > > > > > > > > > ret = crb_cmd_ready(dev, priv); > > > > > > > > > > > > > if (ret) > > > > > > > > > > > > > - return ret; > > > > > > > > > > > > > + goto out_relinquish_locality; > > > > > > > > > > > > > > > > > > > > > > > > > > pa_high = ioread32(&priv->regs_t- > > > >ctrl_cmd_pa_high); > > > > > > > > > > > > > pa_low = > > > > > > > > > > > > > ioread32(&priv->regs_t->ctrl_cmd_pa_low); > > > > > > > > > > > > > @@ -565,6 +567,8 @@ static int crb_map_io(struct > > > > > > > > > > > > > acpi_device *device, struct crb_priv *priv, > > > > > > > > > > > > > > > > > > > > > > > > > > crb_go_idle(dev, priv); > > > > > > > > > > > > > > > > > > > > > > > > > > +out_relinquish_locality: > > > > > > > > > > > > > + > > > > > > > > > > > > > __crb_relinquish_locality(dev, priv, 0); > > > > > > > > > > > > > > > > > > > > > > > > > > return ret; > > > > > > > > > > > > > > > > > > > > > > > > Thanks, please just call it before returning in the error > path. > > > > > > > > > > > > > > > > > > > > > > Can you please elaborate why, isn't the centralized > > > > > > > > > > > exiting of functions preferred kernel coding style? > > > > > > > > > > > https://www.kernel.org/doc/html/v4.11/process/coding > > > > > > > > > > > -sty > > > > > > > > > > > le.h > > > > > > > > > > > tml# > > > > > > > > > > > cent > > > > > > > > > > > ra > > > > > > > > > > > lized-ex > > > > > > > > > > > iting-of-functions > > > > > > > > > > > > > > > > > > > > You exit only from one location (not multiple) and not > > > > > > > > > > from a nested context. Here you just add more > > > > > > > > > > complexity by > > > doing this. > > > > > > > > > > > > > > > > > > Where is the complexity ? I see it as a standard way of > > > > > > > > > undoing on > > > > > exit. > > > > > > > > > Tomas > > > > > > > > > > > > > > > > Jarkko, can you please respond. > > > > > > > > Thanks > > > > > > > > Tomas > > > > > > > > > > > > > > I was away for Mon-Wed last week and did not work on TPM for > > > > > > > Thu- > > > Fri. > > > > > > > > > > > > > > My earlier comment was incorrect as there are two locations > > > > > > > to exit (not sure how I managed to overlook the patch that way). > > > > > > > > > > > > > > Thus, I have only two very minor requets: > > > > > > > > > > > > > > * Remove the extra newline (the last line addition in the patch). > > > > > > Okay > > > > > > > * Use just label named out as we have only one exception > handler. > > > > > > Cannot do that, as the bail out is prior to cmd_ready request > > > > > > so there is no > > > > > need for go_idle which is under out label. > > > > > > > > > > > > > > I'll move on to testing, and if it it passes, I can do those > > > > > > > updates > > > myself. > > > > > > Thanks, I prefer to resend myself. > > > > > > > > > > > > Tomas > > > > > > > > > > Add my tested-by as it is cosmectic change, thanks. > > > > > > > > > > > > What change exactly? I had impression you've accepted the patch as is? > > > > Thanks > > > > Tomas > > > > > > Hmm... maybe there is some misunderstandig but I thought you were > > > going to make the updates above yourself and send a revised patch. > > > > > > Probably, if I remember there were to mails going in asynchronous, > > I've received your tested-by, the second I've sent this answer, so I thought > you came to the conclusion that there is nothing to change in the patch > yourself. > > Frankly I've checked the patch and there are no even extra new lines in my > version unless it has scrambled on the way. > > > > Thanks > > Tomas > > The only thing was the label name. That is why I asked if I can change it by > myself instead of you having to send a follow up patch. Did you send a new > one? Did not find it from patchwork. There is already one 'out' label in that function, what would you prefer for this new label name? Thanks Tomas -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, May 05, 2018 at 09:07:21PM +0000, Winkler, Tomas wrote: > There is already one 'out' label in that function, what would you prefer for this new label name? > Thanks > Tomas Aah, of course. My bad that I did not notice it but please just point me if I miss something obvious like that :-) I'll apply the patch today.. /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> > On Sat, May 05, 2018 at 09:07:21PM +0000, Winkler, Tomas wrote: > > There is already one 'out' label in that function, what would you prefer for > this new label name? > > Thanks > > Tomas > > Aah, of course. My bad that I did not notice it but please just point me if I > miss something obvious like that :-) I'll apply the patch today.. > Thanks Tomas -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, May 09, 2018 at 09:49:49PM +0000, Winkler, Tomas wrote: > > > > On Sat, May 05, 2018 at 09:07:21PM +0000, Winkler, Tomas wrote: > > > There is already one 'out' label in that function, what would you prefer for > > this new label name? > > > Thanks > > > Tomas > > > > Aah, of course. My bad that I did not notice it but please just point me if I > > miss something obvious like that :-) I'll apply the patch today.. > > > Thanks > Tomas It's also in next now! /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c index 7f78482cd157..34fbc6cb097b 100644 --- a/drivers/char/tpm/tpm_crb.c +++ b/drivers/char/tpm/tpm_crb.c @@ -511,8 +511,10 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv, priv->regs_t = crb_map_res(dev, priv, &io_res, buf->control_address, sizeof(struct crb_regs_tail)); - if (IS_ERR(priv->regs_t)) - return PTR_ERR(priv->regs_t); + if (IS_ERR(priv->regs_t)) { + ret = PTR_ERR(priv->regs_t); + goto out_relinquish_locality; + } /* * PTT HW bug w/a: wake up the device to access @@ -520,7 +522,7 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv, */ ret = crb_cmd_ready(dev, priv); if (ret) - return ret; + goto out_relinquish_locality; pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); @@ -565,6 +567,8 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv, crb_go_idle(dev, priv); +out_relinquish_locality: + __crb_relinquish_locality(dev, priv, 0); return ret;
In crb_map_io() function, __crb_request_locality() is called prior to crb_cmd_ready(), but if one of the consecutive function fails the flow bails out instead of trying to relinquish locality. This patch adds goto jump to __crb_relinquish_locality() on the error path. Fixes: 888d867df441 (tpm: cmd_ready command can be issued only after granting locality) Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> --- drivers/char/tpm/tpm_crb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)