Skip to content
Commit ef54ccb6 authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by Paul Moore
Browse files

selinux: selinux_add_opt() callers free memory

The selinux_add_opt() function may need to allocate memory for the
mount options if none has already been allocated, but there is no
need to free that memory on error as the callers handle that.  Drop
the existing kfree() on error to help increase consistency in the
selinux_add_opt() error handling.

This patch also changes selinux_add_opt() to return -EINVAL when
the mount option value, @s, is NULL.  It currently return -ENOMEM.

Link: https://lore.kernel.org/lkml/20220611090550.135674-1-xiujianfeng@huawei.com/T/


Suggested-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
[PM: fix subject, rework commit description language]
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 15ec76fb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment