]> git.ipfire.org Git - thirdparty/systemd.git/commit
udev: destroy manager before cleaning environment 463/head
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 1 Jul 2015 17:25:30 +0000 (19:25 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Wed, 1 Jul 2015 17:30:24 +0000 (19:30 +0200)
commit077fc5e2602effd9b0f46d8ae95271de2b5f2997
treee732b8d59c0f10773ef7eb1852d92dd482b5cd1b
parent0204c4bd69f694b527643ace9d434befce80085c
udev: destroy manager before cleaning environment

Due to our _cleanup_ usage for the udev manager, it will be destroyed
after the "exit:" label has finished. Therefore, it is the last
destruction done in main(). This has two side-effects:
  - mac_selinux is destroyed before the udev manager is, possible causing
    use-after-free if the manager-cleanup accesses selinux data
  - log_close() is called *before* the manager is destroyed, possibly
    re-opening the log if you use --debug (and thus not re-applying the
    --debug option)

Avoid this by moving the manager-handling into a new function called
run(). This function will be left before we enter the "exit:" label in
main(), hence, the manager object will be destroyed early.
src/udev/udevd.c