kaweth: fix firmware download
Subsystems (3)
PATCH 1/2 kaweth: fix firmware download
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 <[email protected]>
--- drivers/net/usb/kaweth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/usb/kaweth.c +1 -2
@@ -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;
Signature · 1 line
2.1.4
PATCH 2/2 kaweth: fix oops upon failed memory allocation
Just return an error upon failure.
Signed-off-by Oliver Neukum <[email protected]>
--- drivers/net/usb/kaweth.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/kaweth.c +2 -0
@@ -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,
Signature · 1 line
2.1.4
Re: [PATCH 2/2] kaweth: fix oops upon failed memory allocation
Quoted 12 lines · Oliver Neukum
Just return an error upon failure.
Signed-off-by Oliver Neukum <[email protected]>--- drivers/net/usb/kaweth.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/usb/kaweth.c +0
-0
drivers/net/usb/kaweth.c static int kaweth_probe( · line 1053
Quoted 5 lines
drivers/net/usb/kaweth.c +2
-0@@ -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
Re: [PATCH 2/2] kaweth: fix oops upon failed memory allocation
Quoted 3 lines · Bjørn Mork
Oliver Neukum <[email protected]> writes:
Eh, that should be "goto
err_free_netdev;", shouldn't it?
Right, thanks. Fixed version coming up.
Regards
Oliver