Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita71464d

Browse files
committed
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
2 parentsf099209 +5555b7c commita71464d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

‎drivers/misc/habanalabs/common/device.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,16 @@ static int device_cdev_sysfs_add(struct hl_device *hdev)
231231

232232
staticvoiddevice_cdev_sysfs_del(structhl_device*hdev)
233233
{
234-
/* device_release() won't be called so must free devices explicitly */
235-
if (!hdev->cdev_sysfs_created) {
236-
kfree(hdev->dev_ctrl);
237-
kfree(hdev->dev);
238-
return;
239-
}
234+
if (!hdev->cdev_sysfs_created)
235+
gotoput_devices;
240236

241237
hl_sysfs_fini(hdev);
242238
cdev_device_del(&hdev->cdev_ctrl,hdev->dev_ctrl);
243239
cdev_device_del(&hdev->cdev,hdev->dev);
240+
241+
put_devices:
242+
put_device(hdev->dev);
243+
put_device(hdev->dev_ctrl);
244244
}
245245

246246
/*
@@ -1371,9 +1371,9 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
13711371
early_fini:
13721372
device_early_fini(hdev);
13731373
free_dev_ctrl:
1374-
kfree(hdev->dev_ctrl);
1374+
put_device(hdev->dev_ctrl);
13751375
free_dev:
1376-
kfree(hdev->dev);
1376+
put_device(hdev->dev);
13771377
out_disabled:
13781378
hdev->disabled= true;
13791379
if (add_cdev_sysfs_on_err)

‎drivers/misc/habanalabs/common/memory.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,7 @@ static int vm_ctx_init_with_ranges(struct hl_ctx *ctx,
16261626
gotohost_hpage_range_err;
16271627
}
16281628
}else {
1629+
kfree(ctx->host_huge_va_range);
16291630
ctx->host_huge_va_range=ctx->host_va_range;
16301631
}
16311632

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp