• Bjorn Andersson's avatar
    net: qrtr: Make qrtr_port_lookup() use RCU · f16a4b26
    Bjorn Andersson authored
    The important part of qrtr_port_lookup() wrt synchronization is that the
    function returns a reference counted struct qrtr_sock, or fail.
    
    As such we need only to ensure that an decrement of the object's
    refcount happens inbetween the finding of the object in the idr and
    qrtr_port_lookup()'s own increment of the object.
    
    By using RCU and putting a synchronization point after we remove the
    mapping from the idr, but before it can be released we achieve this -
    with the benefit of not having to hold the mutex in qrtr_port_lookup().
    Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    f16a4b26
qrtr.c 30.6 KB