* [PATCH] net: ieee802154: fix potential null pointer dereference
@ 2017-05-23 18:11 Gustavo A. R. Silva
2017-05-23 18:13 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-05-23 18:11 UTC (permalink / raw)
To: Harry Morris, linuxdev, Alexander Aring, Stefan Schmidt
Cc: linux-wpan, netdev, linux-kernel, Gustavo A. R. Silva
Null check at line 918: if (!spi) {, implies spi might be NULL.
Function spi_get_drvdata() dereference pointer spi.
Move pointer priv assignment after the null check.
Addresses-Coverity-ID: 1408888
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
drivers/net/ieee802154/ca8210.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index 25fd3b0..ccaf20d 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -912,7 +912,7 @@ static int ca8210_spi_transfer(
)
{
int i, status = 0;
- struct ca8210_priv *priv = spi_get_drvdata(spi);
+ struct ca8210_priv *priv;
struct cas_control *cas_ctl;
if (!spi) {
@@ -923,6 +923,7 @@ static int ca8210_spi_transfer(
return -ENODEV;
}
+ priv = spi_get_drvdata(spi);
reinit_completion(&priv->spi_transfer_complete);
dev_dbg(&spi->dev, "ca8210_spi_transfer called\n");
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ieee802154: fix potential null pointer dereference
2017-05-23 18:11 [PATCH] net: ieee802154: fix potential null pointer dereference Gustavo A. R. Silva
@ 2017-05-23 18:13 ` Marcel Holtmann
2017-05-23 18:28 ` Gustavo A. R. Silva
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2017-05-23 18:13 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Harry Morris, linuxdev, Alexander Aring, Stefan Schmidt,
linux-wpan, netdev, linux-kernel
Hi Gustavo,
> Null check at line 918: if (!spi) {, implies spi might be NULL.
> Function spi_get_drvdata() dereference pointer spi.
> Move pointer priv assignment after the null check.
>
> Addresses-Coverity-ID: 1408888
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> drivers/net/ieee802154/ca8210.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ieee802154: fix potential null pointer dereference
2017-05-23 18:13 ` Marcel Holtmann
@ 2017-05-23 18:28 ` Gustavo A. R. Silva
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-05-23 18:28 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Harry Morris, linuxdev, Alexander Aring, Stefan Schmidt,
linux-wpan, netdev, linux-kernel
Hi Marcel,
Quoting Marcel Holtmann <marcel@holtmann.org>:
> Hi Gustavo,
>
>> Null check at line 918: if (!spi) {, implies spi might be NULL.
>> Function spi_get_drvdata() dereference pointer spi.
>> Move pointer priv assignment after the null check.
>>
>> Addresses-Coverity-ID: 1408888
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> ---
>> drivers/net/ieee802154/ca8210.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> patch has been applied to bluetooth-next tree.
>
Awesome :)
Thanks
--
Gustavo A. R. Silva
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-23 18:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 18:11 [PATCH] net: ieee802154: fix potential null pointer dereference Gustavo A. R. Silva
2017-05-23 18:13 ` Marcel Holtmann
2017-05-23 18:28 ` Gustavo A. R. Silva
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).