[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251024173458.283837-1-nihaal@cse.iitm.ac.in>
Date: Fri, 24 Oct 2025 23:04:55 +0530
From: Abdun Nihaal <nihaal@....iitm.ac.in>
To: isdn@...ux-pingi.de
Cc: Abdun Nihaal <nihaal@....iitm.ac.in>,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH net] isdn: mISDN: hfcsusb: fix memory leak in hfcsusb_probe()
In hfcsusb_probe(), the memory allocated for ctrl_urb gets leaked when
setup_instance() fails with an error code. Fix that by freeing the urb
before freeing the hw structure.
Fixes: 69f52adb2d53 ("mISDN: Add HFC USB driver")
Signed-off-by: Abdun Nihaal <nihaal@....iitm.ac.in>
---
drivers/isdn/hardware/mISDN/hfcsusb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index e54419a4e731..378d0c92622b 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -1904,7 +1904,6 @@ setup_instance(struct hfcsusb *hw, struct device *parent)
mISDN_freebchannel(&hw->bch[1]);
mISDN_freebchannel(&hw->bch[0]);
mISDN_freedchannel(&hw->dch);
- kfree(hw);
return err;
}
@@ -2109,8 +2108,11 @@ hfcsusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
hw->name, __func__, driver_info->vend_name,
conf_str[small_match], ifnum, alt_used);
- if (setup_instance(hw, dev->dev.parent))
+ if (setup_instance(hw, dev->dev.parent)) {
+ usb_free_urb(hw->ctrl_urb);
+ kfree(hw);
return -EIO;
+ }
hw->intf = intf;
usb_set_intfdata(hw->intf, hw);
--
2.43.0
Powered by blists - more mailing lists