linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firewire: fix NULL derefencing in fwnet_probe()
@ 2014-04-29  9:49 Daeseok Youn
  2014-05-12 12:38 ` Stefan Richter
  0 siblings, 1 reply; 2+ messages in thread
From: Daeseok Youn @ 2014-04-29  9:49 UTC (permalink / raw)
  To: stefanr; +Cc: daeseok.youn, linux1394-devel, linux-kernel

"dev" and "net" are NULL when alloc_netdev() is failed.
So just unlock and return an error.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
 drivers/firewire/net.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 4af0a7b..c398645 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1462,8 +1462,8 @@ static int fwnet_probe(struct fw_unit *unit,
 
 	net = alloc_netdev(sizeof(*dev), "firewire%d", fwnet_init_dev);
 	if (net == NULL) {
-		ret = -ENOMEM;
-		goto out;
+		mutex_unlock(&fwnet_device_mutex);
+		return -ENOMEM;
 	}
 
 	allocated_netdev = true;
-- 
1.7.4.4


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

* Re: [PATCH] firewire: fix NULL derefencing in fwnet_probe()
  2014-04-29  9:49 [PATCH] firewire: fix NULL derefencing in fwnet_probe() Daeseok Youn
@ 2014-05-12 12:38 ` Stefan Richter
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Richter @ 2014-05-12 12:38 UTC (permalink / raw)
  To: Daeseok Youn; +Cc: linux1394-devel, linux-kernel

On Apr 29 Daeseok Youn wrote:
> "dev" and "net" are NULL when alloc_netdev() is failed.
> So just unlock and return an error.
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>

Pushed to linux1394.git.  Thank you.

> ---
>  drivers/firewire/net.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
> index 4af0a7b..c398645 100644
> --- a/drivers/firewire/net.c
> +++ b/drivers/firewire/net.c
> @@ -1462,8 +1462,8 @@ static int fwnet_probe(struct fw_unit *unit,
>  
>  	net = alloc_netdev(sizeof(*dev), "firewire%d", fwnet_init_dev);
>  	if (net == NULL) {
> -		ret = -ENOMEM;
> -		goto out;
> +		mutex_unlock(&fwnet_device_mutex);
> +		return -ENOMEM;
>  	}
>  
>  	allocated_netdev = true;

-- 
Stefan Richter
-=====-====- -=-= -==--
http://arcgraph.de/sr/

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

end of thread, other threads:[~2014-05-12 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-29  9:49 [PATCH] firewire: fix NULL derefencing in fwnet_probe() Daeseok Youn
2014-05-12 12:38 ` Stefan Richter

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).