• David Howells's avatar
    KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload() · 0837e49a
    David Howells authored
    rcu_dereference_key() and user_key_payload() are currently being used in
    two different, incompatible ways:
    
     (1) As a wrapper to rcu_dereference() - when only the RCU read lock used
         to protect the key.
    
     (2) As a wrapper to rcu_dereference_protected() - when the key semaphor is
         used to protect the key and the may be being modified.
    
    Fix this by splitting both of the key wrappers to produce:
    
     (1) RCU accessors for keys when caller has the key semaphore locked:
    
    	dereference_key_locked()
    	user_key_payload_locked()
    
     (2) RCU accessors for keys when caller holds the RCU read lock:
    
    	dereference_key_rcu()
    	user_key_payload_rcu()
    
    This should fix following warning in the NFS idmapper
    
      ===============================
      [ INFO: suspicious RCU usage. ]
      4.10.0 #1 Tainted: G        W
      -------------------------------
      ./include/keys/user-type.h:53 suspicious rcu_dereference_protected() usage!
      other info that might help us debu...
    0837e49a
digsig.c 5.6 KB