linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for macchiatobin
@ 2019-07-26 15:31 Pascal van Leeuwen
  2019-07-30  8:12 ` Antoine Tenart
  0 siblings, 1 reply; 5+ messages in thread
From: Pascal van Leeuwen @ 2019-07-26 15:31 UTC (permalink / raw)
  To: linux-crypto; +Cc: antoine.tenart, herbert, davem, Pascal van Leeuwen

This small patch fixes a null pointer derefence panic that occurred when
unloading the driver (using rmmod) on macchiatobin due to not setting
the platform driver data properly in the probe routine.

Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
---
 drivers/crypto/inside-secure/safexcel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
index 45443bf..423ea2d 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
@@ -1274,6 +1274,8 @@ static int safexcel_probe(struct platform_device *pdev)
 	priv->dev = dev;
 	priv->version = (enum safexcel_eip_version)of_device_get_match_data(dev);
 
+	platform_set_drvdata(pdev, priv);
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	priv->base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(priv->base)) {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for macchiatobin
  2019-07-26 15:31 [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for macchiatobin Pascal van Leeuwen
@ 2019-07-30  8:12 ` Antoine Tenart
  2019-07-30 10:27   ` Pascal Van Leeuwen
  0 siblings, 1 reply; 5+ messages in thread
From: Antoine Tenart @ 2019-07-30  8:12 UTC (permalink / raw)
  To: Pascal van Leeuwen
  Cc: linux-crypto, antoine.tenart, herbert, davem, Pascal van Leeuwen

Hi Pascal,

On Fri, Jul 26, 2019 at 05:31:09PM +0200, Pascal van Leeuwen wrote:
> This small patch fixes a null pointer derefence panic that occurred when
> unloading the driver (using rmmod) on macchiatobin due to not setting
> the platform driver data properly in the probe routine.
> 
> Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>

As this is a fix you should add a Fixes: tag so that the patch gets
applied to stable trees. You can have a look at what this tag looks like
at: https://www.kernel.org/doc/html/latest/process/submitting-patches.html

> ---
>  drivers/crypto/inside-secure/safexcel.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
> index 45443bf..423ea2d 100644
> --- a/drivers/crypto/inside-secure/safexcel.c
> +++ b/drivers/crypto/inside-secure/safexcel.c
> @@ -1274,6 +1274,8 @@ static int safexcel_probe(struct platform_device *pdev)
>  	priv->dev = dev;
>  	priv->version = (enum safexcel_eip_version)of_device_get_match_data(dev);
>  
> +	platform_set_drvdata(pdev, priv);
> +

This is already done in safexcel_probe(), near the end of the function.
I think you should remove the second call, to avoid setting the platform
driver data twice.

Out of curiosity, why calling platform_set_drvdata() earlier in the
probe fixes unloading the driver with rmmod?

Thanks!
Antoine

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for macchiatobin
  2019-07-30  8:12 ` Antoine Tenart
@ 2019-07-30 10:27   ` Pascal Van Leeuwen
  2019-07-30 11:34     ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Pascal Van Leeuwen @ 2019-07-30 10:27 UTC (permalink / raw)
  To: Antoine Tenart, Pascal van Leeuwen; +Cc: linux-crypto, herbert, davem

-----Original Message-----
> From: Antoine Tenart <antoine.tenart@bootlin.com>
> Sent: Tuesday, July 30, 2019 10:12 AM
> To: Pascal van Leeuwen <pascalvanl@gmail.com>
> Cc: linux-crypto@vger.kernel.org; antoine.tenart@bootlin.com; herbert@gondor.apana.org.au;
> davem@davemloft.net; Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
> Subject: Re: [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for
> macchiatobin
> 
> Hi Pascal,
> 
> On Fri, Jul 26, 2019 at 05:31:09PM +0200, Pascal van Leeuwen wrote:
> > This small patch fixes a null pointer derefence panic that occurred when
> > unloading the driver (using rmmod) on macchiatobin due to not setting
> > the platform driver data properly in the probe routine.
> >
> > Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
> 
> As this is a fix you should add a Fixes: tag so that the patch gets
> applied to stable trees. You can have a look at what this tag looks like
> at: https://www.kernel.org/doc/html/latest/process/submitting-patches.html
> 
As you already figured out by now, this patch just fixes something
that was broken by one of my earlier patches (which has not been
applied just yet). So I don't think it applies to stable trees.

> > ---
> >  drivers/crypto/inside-secure/safexcel.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-
> secure/safexcel.c
> > index 45443bf..423ea2d 100644
> > --- a/drivers/crypto/inside-secure/safexcel.c
> > +++ b/drivers/crypto/inside-secure/safexcel.c
> > @@ -1274,6 +1274,8 @@ static int safexcel_probe(struct platform_device *pdev)
> >  	priv->dev = dev;
> >  	priv->version = (enum safexcel_eip_version)of_device_get_match_data(dev);
> >
> > +	platform_set_drvdata(pdev, priv);
> > +
> 
> This is already done in safexcel_probe(), near the end of the function.
> I think you should remove the second call, to avoid setting the platform
> driver data twice.
> 
Well, actually, my first patch that you are reviewing right now
accidentally removed that other call to platform_set_drvdata ...

> Out of curiosity, why calling platform_set_drvdata() earlier in the
> probe fixes unloading the driver with rmmod?
> 
Not really. As long as it does get set somewhere :-)

> Thanks!
> Antoine
> 
> --
> Antoine Ténart, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for macchiatobin
  2019-07-30 10:27   ` Pascal Van Leeuwen
@ 2019-07-30 11:34     ` Herbert Xu
  2019-07-30 12:24       ` Pascal Van Leeuwen
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2019-07-30 11:34 UTC (permalink / raw)
  To: Pascal Van Leeuwen
  Cc: Antoine Tenart, Pascal van Leeuwen, linux-crypto, davem

On Tue, Jul 30, 2019 at 10:27:26AM +0000, Pascal Van Leeuwen wrote:
>
> As you already figured out by now, this patch just fixes something
> that was broken by one of my earlier patches (which has not been
> applied just yet). So I don't think it applies to stable trees.

If your earlier patch has been applied to cryptodev already then you
should use a Fixes header.  If not then you should repost that patch
with the fix folded into it.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for macchiatobin
  2019-07-30 11:34     ` Herbert Xu
@ 2019-07-30 12:24       ` Pascal Van Leeuwen
  0 siblings, 0 replies; 5+ messages in thread
From: Pascal Van Leeuwen @ 2019-07-30 12:24 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Antoine Tenart, Pascal van Leeuwen, linux-crypto, davem

> -----Original Message-----
> From: Herbert Xu <herbert@gondor.apana.org.au>
> Sent: Tuesday, July 30, 2019 1:35 PM
> To: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
> Cc: Antoine Tenart <antoine.tenart@bootlin.com>; Pascal van Leeuwen
> <pascalvanl@gmail.com>; linux-crypto@vger.kernel.org; davem@davemloft.net
> Subject: Re: [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for
> macchiatobin
> 
> On Tue, Jul 30, 2019 at 10:27:26AM +0000, Pascal Van Leeuwen wrote:
> >
> > As you already figured out by now, this patch just fixes something
> > that was broken by one of my earlier patches (which has not been
> > applied just yet). So I don't think it applies to stable trees.
> 
> If your earlier patch has been applied to cryptodev already then you
> should use a Fixes header.  If not then you should repost that patch
> with the fix folded into it.
> 
Yes, I understood that much. But thanks for spelling it out ;-)

> Thanks,
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-30 12:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-26 15:31 [PATCH] crypto: inside-secure - Fix null ptr derefence on rmmod for macchiatobin Pascal van Leeuwen
2019-07-30  8:12 ` Antoine Tenart
2019-07-30 10:27   ` Pascal Van Leeuwen
2019-07-30 11:34     ` Herbert Xu
2019-07-30 12:24       ` Pascal Van Leeuwen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).