Skip to content

Commit befa491

Browse files
committed
Merge tag 'selinux-pr-20210830' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux update from Paul Moore: "We've got an unusually small SELinux pull request for v5.15 that consists of only one (?!) patch that is really pretty minor when you look at it. Unsurprisingly it passes all of our tests and merges cleanly on top of your tree right now, please merge this for v5.15" * tag 'selinux-pr-20210830' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: return early for possible NULL audit buffers
2 parents e55f0c4 + 893c47d commit befa491

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

security/selinux/hooks.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,6 +3325,8 @@ static int selinux_inode_setxattr(struct user_namespace *mnt_userns,
33253325
}
33263326
ab = audit_log_start(audit_context(),
33273327
GFP_ATOMIC, AUDIT_SELINUX_ERR);
3328+
if (!ab)
3329+
return rc;
33283330
audit_log_format(ab, "op=setxattr invalid_context=");
33293331
audit_log_n_untrustedstring(ab, value, audit_size);
33303332
audit_log_end(ab);
@@ -6552,6 +6554,8 @@ static int selinux_setprocattr(const char *name, void *value, size_t size)
65526554
ab = audit_log_start(audit_context(),
65536555
GFP_ATOMIC,
65546556
AUDIT_SELINUX_ERR);
6557+
if (!ab)
6558+
return error;
65556559
audit_log_format(ab, "op=fscreate invalid_context=");
65566560
audit_log_n_untrustedstring(ab, value, audit_size);
65576561
audit_log_end(ab);

security/selinux/ss/services.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,8 @@ static int compute_sid_handle_invalid_context(
16731673
if (context_struct_to_string(policydb, newcontext, &n, &nlen))
16741674
goto out;
16751675
ab = audit_log_start(audit_context(), GFP_ATOMIC, AUDIT_SELINUX_ERR);
1676+
if (!ab)
1677+
goto out;
16761678
audit_log_format(ab,
16771679
"op=security_compute_sid invalid_context=");
16781680
/* no need to record the NUL with untrusted strings */

0 commit comments

Comments
 (0)