audit: fix a net reference leak in audit_send_reply()
authorPaul Moore <paul@paul-moore.com>
Mon, 20 Apr 2020 14:09:29 +0000 (10:09 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Apr 2021 10:05:41 +0000 (12:05 +0200)
commit61ec5d8de5786a55c4889d746bc94651fc399ef0
treec1562ca218b65be6d68841f10d682b6a16042604
parent03691e3b50dc97ddd7f39a98a376ac7651c65605
audit: fix a net reference leak in audit_send_reply()

commit a48b284b403a4a073d8beb72d2bb33e54df67fb6 upstream.

If audit_send_reply() fails when trying to create a new thread to
send the reply it also fails to cleanup properly, leaking a reference
to a net structure.  This patch fixes the error path and makes a
handful of other cleanups that came up while fixing the code.

Reported-by: teroincn@gmail.com
Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Cc: <stable@vger.kernel.org> # 4.9.x
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/audit.c