Skip to content

Commit 55abae4

Browse files
committed
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()
2 parents 1b8af65 + 891e0ea commit 55abae4

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/firewire/core-device.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,14 +717,11 @@ static void create_units(struct fw_device *device)
717717
fw_unit_attributes,
718718
&unit->attribute_group);
719719

720-
if (device_register(&unit->device) < 0)
721-
goto skip_unit;
722-
723720
fw_device_get(device);
724-
continue;
725-
726-
skip_unit:
727-
kfree(unit);
721+
if (device_register(&unit->device) < 0) {
722+
put_device(&unit->device);
723+
continue;
724+
}
728725
}
729726
}
730727

0 commit comments

Comments
 (0)