GoogleGit

commit3bfc1e9e0c7d0c0e3f52ee1f3803482416afa295[log][tgz]
authorAlistair Strachan <alistair.strachan@imgtec.com>Wed Apr 10 16:35:14 2013 -0700
committerRom Lemarchand <romlem@google.com>Wed Oct 23 20:02:22 2013 -0700
tree6db4c838e068d8a780daf251800d6809ab70e99a
parentebb8269bbb05b06ecedca3e21b3e65f23d48eadd[diff]
sync: Fix a race condition between release_obj and print_obj

Before this change, a timeline would only be removed from the timeline
list *after* the sync driver had its release_obj() called. However, the
driver's release_obj() may free resources needed by print_obj().

Although the timeline list is locked when print_obj() is called, it is
not locked when release_obj() is called. If one CPU was in print_obj()
when another was in release_obj(), the print_obj() may make unsafe
accesses.

It is not actually necessary to hold the timeline list lock when calling
release_obj() if the call is made after the timeline is unlinked from
the list, since there is no possibility another thread could be in --
or enter -- print_obj() for that timeline.

This change moves the release_obj() call to after the timeline is
unlinked, preventing the above race from occurring.

Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
1 file changed
tree: 6db4c838e068d8a780daf251800d6809ab70e99a
  1. .gitignore
  2. .mailmap
  3. COPYING
  4. CREDITS
  5. Documentation/
  6. Kbuild
  7. Kconfig
  8. MAINTAINERS
  9. Makefile
  10. README
  11. REPORTING-BUGS
  12. android/
  13. arch/
  14. block/
  15. crypto/
  16. drivers/
  17. firmware/
  18. fs/
  19. include/
  20. init/
  21. ipc/
  22. kernel/
  23. lib/
  24. mm/
  25. net/
  26. samples/
  27. scripts/
  28. security/
  29. sound/
  30. tools/
  31. usr/
  32. virt/