audit: fix the RCU locking for the auditd_connection structure

This patch is the stable-4.11.y backport of commit 48d0e023af97 (same
subject) in Linus' master branch.  Unfortunately the commit in Linus'
tree doesn't merge cleanly in the v4.11.y tree due to the auditd PID
conversion from an int/pid_t to the pid structure; almost all of the
merge fuzzing in this patch is due to that difference.

Original patch description:

  "Cong Wang correctly pointed out that the RCU read locking of the
   auditd_connection struct was wrong, this patch correct this by
   adopting a more traditional, and correct RCU locking model.

   This patch is heavily based on an earlier prototype by Cong Wang."

Cc: <> # 4.11.x-
Reported-by: Cong Wang <>
Signed-off-by: Cong Wang <>
Signed-off-by: Paul Moore <>
1 file changed