audit: return on memory error to avoid null pointer dereference
authorRichard Guy Briggs <rgb@redhat.com>
Wed, 21 Feb 2018 09:30:07 +0000 (04:30 -0500)
committerivanmeler <i_ivan@windowslive.com>
Wed, 13 Apr 2022 21:13:43 +0000 (21:13 +0000)
commit7b286b3d551b858be31b94e520d98b0728de634d
tree762ebe163745ad02c6e0333b10b913766f455c76
parentf65bd0a772b48db679e06166d90c338184f138f7
audit: return on memory error to avoid null pointer dereference

[ Upstream commit 23138ead270045f1b3e912e667967b6094244999 ]

If there is a memory allocation error when trying to change an audit
kernel feature value, the ignored allocation error will trigger a NULL
pointer dereference oops on subsequent use of that pointer.  Return
instead.

Passes audit-testsuite.
See: https://github.com/linux-audit/audit-kernel/issues/76

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
[PM: not necessary (other funcs check for NULL), but a good practice]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/audit.c