Skip to content

Commit

Permalink
Merge tag 'firewire-fixes-6.7-rc4' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/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()
  • Loading branch information
Linus Torvalds committed Dec 3, 2023
2 parents 1b8af65 + 891e0ea commit 55abae4
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/firewire/core-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 55abae4

Please sign in to comment.