netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2]fixes to kaweth in response to Umap2 testing
@ 2016-08-17 13:51 Oliver Neukum
       [not found] ` <1471441916-19656-1-git-send-email-oneukum-IBi9RG/b67k@public.gmane.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Oliver Neukum @ 2016-08-17 13:51 UTC (permalink / raw)
  To: linux-usb, stern, netdev, davem

These patches fix an oops in firmware downloading and an oops due
to a memory allocation failure

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

* [PATCH v2 1/2] kaweth: fix firmware download
       [not found] ` <1471441916-19656-1-git-send-email-oneukum-IBi9RG/b67k@public.gmane.org>
@ 2016-08-17 13:51   ` Oliver Neukum
  0 siblings, 0 replies; 4+ messages in thread
From: Oliver Neukum @ 2016-08-17 13:51 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	netdev-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: Oliver Neukum

This fixes the oops discovered by the Umap2 project and Alan Stern.
The intf member needs to be set before the firmware is downloaded.

Signed-off-by: Oliver Neukum <oneukum-IBi9RG/b67k@public.gmane.org>
---
 drivers/net/usb/kaweth.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 770212b..37bf715 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1029,6 +1029,7 @@ static int kaweth_probe(
 	kaweth = netdev_priv(netdev);
 	kaweth->dev = udev;
 	kaweth->net = netdev;
+	kaweth->intf = intf;
 
 	spin_lock_init(&kaweth->device_lock);
 	init_waitqueue_head(&kaweth->term_wait);
@@ -1139,8 +1140,6 @@ err_fw:
 
 	dev_dbg(dev, "Initializing net device.\n");
 
-	kaweth->intf = intf;

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

* [PATCH v2 2/2] kaweth: fix oops upon failed memory allocation
  2016-08-17 13:51 [PATCH v2 0/2]fixes to kaweth in response to Umap2 testing Oliver Neukum
       [not found] ` <1471441916-19656-1-git-send-email-oneukum-IBi9RG/b67k@public.gmane.org>
@ 2016-08-17 13:51 ` Oliver Neukum
  2016-08-19  6:25 ` [PATCH v2 0/2]fixes to kaweth in response to Umap2 testing David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Oliver Neukum @ 2016-08-17 13:51 UTC (permalink / raw)
  To: linux-usb, stern, netdev, davem; +Cc: Oliver Neukum

Just return an error upon failure.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/usb/kaweth.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 37bf715..528b9c9 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1009,6 +1009,7 @@ static int kaweth_probe(
 	struct net_device *netdev;
 	const eth_addr_t bcast_addr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
 	int result = 0;
+	int rv = -EIO;
 
 	dev_dbg(dev,
 		"Kawasaki Device Probe (Device number:%d): 0x%4.4x:0x%4.4x:0x%4.4x\n",
@@ -1049,6 +1050,10 @@ static int kaweth_probe(
 		/* Download the firmware */
 		dev_info(dev, "Downloading firmware...\n");
 		kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL);
+		if (!kaweth->firmware_buf) {
+			rv = -ENOMEM;
+			goto err_free_netdev;
+		}
 		if ((result = kaweth_download_firmware(kaweth,
 						      "kaweth/new_code.bin",
 						      100,
@@ -1203,7 +1208,7 @@ err_only_tx:
 err_free_netdev:
 	free_netdev(netdev);
 
-	return -EIO;
+	return rv;
 }
 
 /****************************************************************
-- 
2.1.4

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

* Re: [PATCH v2 0/2]fixes to kaweth in response to Umap2 testing
  2016-08-17 13:51 [PATCH v2 0/2]fixes to kaweth in response to Umap2 testing Oliver Neukum
       [not found] ` <1471441916-19656-1-git-send-email-oneukum-IBi9RG/b67k@public.gmane.org>
  2016-08-17 13:51 ` [PATCH v2 2/2] kaweth: fix oops upon failed memory allocation Oliver Neukum
@ 2016-08-19  6:25 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-08-19  6:25 UTC (permalink / raw)
  To: oneukum; +Cc: linux-usb, stern, netdev

From: Oliver Neukum <oneukum@suse.com>
Date: Wed, 17 Aug 2016 15:51:54 +0200

> These patches fix an oops in firmware downloading and an oops due
> to a memory allocation failure

Series applied, thanks Oliver.

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

end of thread, other threads:[~2016-08-19  6:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-17 13:51 [PATCH v2 0/2]fixes to kaweth in response to Umap2 testing Oliver Neukum
     [not found] ` <1471441916-19656-1-git-send-email-oneukum-IBi9RG/b67k@public.gmane.org>
2016-08-17 13:51   ` [PATCH v2 1/2] kaweth: fix firmware download Oliver Neukum
2016-08-17 13:51 ` [PATCH v2 2/2] kaweth: fix oops upon failed memory allocation Oliver Neukum
2016-08-19  6:25 ` [PATCH v2 0/2]fixes to kaweth in response to Umap2 testing David Miller

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