[PATCH 1/2] kaweth: fix firmware download
Subsystems:
networking drivers , the rest , usb networking drivers
STALE3653d
4 messages,
2 authors,
2016-08-17 · open the first message on its own page
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
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
Oliver Neukum [off-list ref] writes:
quoted hunk 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
On Wed, 2016-08-17 at 15:15 +0200, Bjørn Mork wrote: Oliver Neukum [off-list ref] writes: Eh, that should be "goto err_free_netdev;", shouldn't it?
Right, thanks. Fixed version coming up.
Regards
Oliver