Skip to content
  • Linus Torvalds's avatar
    bluetooth: fix list handling · 9b284cbd
    Linus Torvalds authored
    Commit 835a6a2f
    
     ("Bluetooth: Stop sabotaging list poisoning")
    thought that the code was sabotaging the list poisoning when NULL'ing
    out the list pointers and removed it.
    
    But what was going on was that the bluetooth code was using NULL
    pointers for the list as a way to mark it empty, and that commit just
    broke it (and replaced the test with NULL with a "list_empty()" test on
    a uninitialized list instead, breaking things even further).
    
    So fix it all up to use the regular and real list_empty() handling
    (which does not use NULL, but a pointer to itself), also making sure to
    initialize the list properly (the previous NULL case was initialized
    implicitly by the session being allocated with kzalloc())
    
    This is a combination of patches by Marcel Holtmann and Tedd Ho-Jeong
    An.
    
    [ I would normally expect to get this through the bt tree, but I'm going
      to release -rc1, so I'm just committing this directly   - Linus ]
    
    Reported-and-tested-by: default avatarJörg Otte <jrg.otte@gmail.com>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Original-by: default avatarTedd Ho-Jeong An <tedd.an@intel.com>
    Original-by: default avatarMarcel Holtmann <marcel@holtmann.org&gt;:>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    9b284cbd