Skip to content

Commit 5fcfb6d

Browse files
oneukumdavem330
authored andcommitted
hso: fix bailout in error case of probe
The driver tries to reuse code for disconnect in case of a failed probe. If resources need to be freed after an error in probe, the netdev must not be freed because it has never been registered. Fix it by telling the helper which path we are in. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8ed54f1 commit 5fcfb6d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/usb/hso.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,7 +2357,7 @@ static int remove_net_device(struct hso_device *hso_dev)
23572357
}
23582358

23592359
/* Frees our network device */
2360-
static void hso_free_net_device(struct hso_device *hso_dev)
2360+
static void hso_free_net_device(struct hso_device *hso_dev, bool bailout)
23612361
{
23622362
int i;
23632363
struct hso_net *hso_net = dev2net(hso_dev);
@@ -2380,7 +2380,7 @@ static void hso_free_net_device(struct hso_device *hso_dev)
23802380
kfree(hso_net->mux_bulk_tx_buf);
23812381
hso_net->mux_bulk_tx_buf = NULL;
23822382

2383-
if (hso_net->net)
2383+
if (hso_net->net && !bailout)
23842384
free_netdev(hso_net->net);
23852385

23862386
kfree(hso_dev);
@@ -2556,7 +2556,7 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
25562556

25572557
return hso_dev;
25582558
exit:
2559-
hso_free_net_device(hso_dev);
2559+
hso_free_net_device(hso_dev, true);
25602560
return NULL;
25612561
}
25622562

@@ -3133,7 +3133,7 @@ static void hso_free_interface(struct usb_interface *interface)
31333133
rfkill_unregister(rfk);
31343134
rfkill_destroy(rfk);
31353135
}
3136-
hso_free_net_device(network_table[i]);
3136+
hso_free_net_device(network_table[i], false);
31373137
}
31383138
}
31393139
}

0 commit comments

Comments
 (0)