* [PATCH 1/2] kaweth: fix firmware download
@ 2016-08-17 9:59 Oliver Neukum
2016-08-17 9:59 ` [PATCH 2/2] kaweth: fix oops upon failed memory allocation Oliver Neukum
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Neukum @ 2016-08-17 9:59 UTC (permalink / raw)
To: linux-usb, netdev, davem, stern; +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@suse.com>
---
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;
-
kaweth->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!kaweth->tx_urb)
goto err_free_netdev;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] kaweth: fix oops upon failed memory allocation
2016-08-17 9:59 [PATCH 1/2] kaweth: fix firmware download Oliver Neukum
@ 2016-08-17 9:59 ` Oliver Neukum
2016-08-17 13:15 ` Bjørn Mork
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Neukum @ 2016-08-17 9:59 UTC (permalink / raw)
To: linux-usb, netdev, davem, stern; +Cc: Oliver Neukum
Just return an error upon failure.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/net/usb/kaweth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 37bf715..3cd6906 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1049,6 +1049,8 @@ 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)
+ return -ENOMEM;
if ((result = kaweth_download_firmware(kaweth,
"kaweth/new_code.bin",
100,
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] kaweth: fix oops upon failed memory allocation
2016-08-17 9:59 ` [PATCH 2/2] kaweth: fix oops upon failed memory allocation Oliver Neukum
@ 2016-08-17 13:15 ` Bjørn Mork
2016-08-17 13:33 ` Oliver Neukum
0 siblings, 1 reply; 4+ messages in thread
From: Bjørn Mork @ 2016-08-17 13:15 UTC (permalink / raw)
To: Oliver Neukum; +Cc: linux-usb, netdev, davem, stern
Oliver Neukum <oneukum@suse.com> writes:
> Just return an error upon failure.
>
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
> drivers/net/usb/kaweth.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
> index 37bf715..3cd6906 100644
> --- a/drivers/net/usb/kaweth.c
> +++ b/drivers/net/usb/kaweth.c
> @@ -1049,6 +1049,8 @@ 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)
> + return -ENOMEM;
Eh, that should be "goto err_free_netdev;", shouldn't it?
Bjørn
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] kaweth: fix oops upon failed memory allocation
2016-08-17 13:15 ` Bjørn Mork
@ 2016-08-17 13:33 ` Oliver Neukum
0 siblings, 0 replies; 4+ messages in thread
From: Oliver Neukum @ 2016-08-17 13:33 UTC (permalink / raw)
To: Bjørn Mork; +Cc: davem, stern, linux-usb, netdev
On Wed, 2016-08-17 at 15:15 +0200, Bjørn Mork wrote:
> Oliver Neukum <oneukum@suse.com> writes:
> Eh, that should be "goto err_free_netdev;", shouldn't it?
Right, thanks. Fixed version coming up.
Regards
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-17 13:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17 9:59 [PATCH 1/2] kaweth: fix firmware download Oliver Neukum
2016-08-17 9:59 ` [PATCH 2/2] kaweth: fix oops upon failed memory allocation Oliver Neukum
2016-08-17 13:15 ` Bjørn Mork
2016-08-17 13:33 ` Oliver Neukum
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.