mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
This tag contains two bug fixes for v5.10-rc7:
- Memory leak every time a user closes the file-descriptor of the device. The driver didn't always free all the VA range structures it maintains per user. - Memory leak every time the driver was removed. The device structure was not "put" at the device's teardown function in the driver. -----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEE7TEboABC71LctBLFZR1NuKta54AFAl/EryUTHG9nYWJiYXlA a2VybmVsLm9yZwAKCRBlHU24q1rngHQqCACrUuPsezMpuwDucChJrBamp5k1hkkH SfkevnoKN/E/TTn3wUHUVZXCVf/3Y6d23V5FyON3+yru/mkke6OngH1eeA7zy+61 9qyOhOvWib2KD+gHJvOqUiKwhYQuZvw79pnsJXg379Sv8Fa45qZzMBN2+gCnWWTF tah8WYZ12UVM6WSKSbTelQZVsYECx8hgc719o8pI+LPUBf73dklBADc2qYSZpFfd IUBoPqOmwPM86lJ9j8yN1aFCOEkhMXpRgP+zTGvtNW+4Dj4J/1MolYb7wM3cM3eE 9abk1IIHE6guFEZm6JYgGkOlvLl4MfV+3aMHQ8VWEFFJ4hmOk+Xzfh07 =u8Ho -----END PGP SIGNATURE----- Merge tag 'misc-habanalabs-fixes-2020-11-30' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux into char-misc-linus Oded writes: This tag contains two bug fixes for v5.10-rc7: - Memory leak every time a user closes the file-descriptor of the device. The driver didn't always free all the VA range structures it maintains per user. - Memory leak every time the driver was removed. The device structure was not "put" at the device's teardown function in the driver. * tag 'misc-habanalabs-fixes-2020-11-30' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: habanalabs: put devices before driver removal habanalabs: free host huge va_range if not used
This commit is contained in:
commit
a71464d0b9
2 changed files with 9 additions and 8 deletions
|
@ -231,16 +231,16 @@ static int device_cdev_sysfs_add(struct hl_device *hdev)
|
|||
|
||||
static void device_cdev_sysfs_del(struct hl_device *hdev)
|
||||
{
|
||||
/* device_release() won't be called so must free devices explicitly */
|
||||
if (!hdev->cdev_sysfs_created) {
|
||||
kfree(hdev->dev_ctrl);
|
||||
kfree(hdev->dev);
|
||||
return;
|
||||
}
|
||||
if (!hdev->cdev_sysfs_created)
|
||||
goto put_devices;
|
||||
|
||||
hl_sysfs_fini(hdev);
|
||||
cdev_device_del(&hdev->cdev_ctrl, hdev->dev_ctrl);
|
||||
cdev_device_del(&hdev->cdev, hdev->dev);
|
||||
|
||||
put_devices:
|
||||
put_device(hdev->dev);
|
||||
put_device(hdev->dev_ctrl);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1371,9 +1371,9 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
|
|||
early_fini:
|
||||
device_early_fini(hdev);
|
||||
free_dev_ctrl:
|
||||
kfree(hdev->dev_ctrl);
|
||||
put_device(hdev->dev_ctrl);
|
||||
free_dev:
|
||||
kfree(hdev->dev);
|
||||
put_device(hdev->dev);
|
||||
out_disabled:
|
||||
hdev->disabled = true;
|
||||
if (add_cdev_sysfs_on_err)
|
||||
|
|
|
@ -1626,6 +1626,7 @@ static int vm_ctx_init_with_ranges(struct hl_ctx *ctx,
|
|||
goto host_hpage_range_err;
|
||||
}
|
||||
} else {
|
||||
kfree(ctx->host_huge_va_range);
|
||||
ctx->host_huge_va_range = ctx->host_va_range;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue