diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-12-03 09:03:07 +0900 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-12-03 09:03:07 +0900 |
commit | 55abae438c3cf39f66c3e0cb922c3d915363afb5 (patch) | |
tree | 5a81c17042c040380f4791f3741e2025c24a90eb /drivers/firewire | |
parent | 1b8af6552cb7c9bf1194e871f8d733a19b113230 (diff) | |
parent | 891e0eab32a57fca4d36c5162628eb0bcb1f0edf (diff) | |
download | linux-stable-55abae438c3cf39f66c3e0cb922c3d915363afb5.tar.gz linux-stable-55abae438c3cf39f66c3e0cb922c3d915363afb5.tar.bz2 linux-stable-55abae438c3cf39f66c3e0cb922c3d915363afb5.zip |
Merge tag 'firewire-fixes-6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire fix from Takashi Sakamoto:
"A single patch to fix long-standing issue of memory leak at failure of
device registration for fw_unit. We rarely encounter the issue, but it
should be applied to stable releases, since it fixes inappropriate API
usage"
* tag 'firewire-fixes-6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
firewire: core: fix possible memory leak in create_units()
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/core-device.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index aa597cda0d88..2828e9573e90 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -717,14 +717,11 @@ static void create_units(struct fw_device *device) fw_unit_attributes, &unit->attribute_group); - if (device_register(&unit->device) < 0) - goto skip_unit; - fw_device_get(device); - continue; - - skip_unit: - kfree(unit); + if (device_register(&unit->device) < 0) { + put_device(&unit->device); + continue; + } } } |