From: Arina Kharlamova <arin…@mbzuai.ac.ae> xirc2ps_probe() allocates the net device with alloc_etherdev() and returns the result of xirc2ps_config(). When xirc2ps_config() fails, the net device is never freed. xirc2ps_detach() is the only caller of free_netdev() and the PCMCIA core does not call the remove callback after a failed probe. Free the net device in xirc2ps_probe() when xirc2ps_config() returns an error. The interrupt that was requested with the net device as dev_id is already gone at that point, because the config_error path calls xirc2ps_release() and pcmcia_disable_device() frees it. Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions") Signed-off-by: Arina Kharlamova <arin…@mbzuai.ac.ae> --- drivers/net/ethernet/xircom/xirc2ps_cs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c index 97e88886253f..4e57b7657d94 100644 --- a/drivers/net/ethernet/xircom/xirc2ps_cs.c +++ b/drivers/net/ethernet/xircom/xirc2ps_cs.c @@ -475,6 +475,7 @@ xirc2ps_probe(struct pcmcia_device *link) { struct net_device *dev; struct local_info *local; + int err; dev_dbg(&link->dev, "attach()\n"); @@ -496,7 +497,11 @@ xirc2ps_probe(struct pcmcia_device *link) dev->watchdog_timeo = TX_TIMEOUT; INIT_WORK(&local->tx_timeout_task, xirc2ps_tx_timeout_task); - return xirc2ps_config(link); + err = xirc2ps_config(link); + if (err) + free_netdev(dev); + + return err; } /* xirc2ps_attach */ static void
-- Git-157)