Skip to contentSkip to conversation

selinuxfs: Fix sel_write_enforce broken return value

PATCH In review Joe Perches 3 participants 3 messages Mar 24, 2015 – Mar 26, 2015 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinuxfs: Fix sel_write_enforce broken return value

Return a negative error value like the rest of the entries in this function.

---
Maybe this should be stable, it goes back to commit b77a493b1dc8 ("SELinux: standardize return code handling in selinuxfs.c") back in Nov 2010, but it's guarded by a #ifdef CONFIG_SECURITY_SELINUX_DEVELOP so it probably doesn't matter much.

 security/selinux/selinuxfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/selinuxfs.c +1 -1
index 1684bcc..5fde343 100644
@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
 		goto out;
 
 	/* No partial writes. */
-	length = EINVAL;
+	length = -EINVAL;
 	if (*ppos != 0)
 		goto out;
 
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Joe Perches

Return a negative error value like the rest
of the entries in this function.

Quoted 6 lines

---
Maybe this should be stable, it goes back to commit b77a493b1dc8 ("SELinux: standardize return code handling in selinuxfs.c") back in Nov 2010, but it's guarded by a #ifdef CONFIG_SECURITY_SELINUX_DEVELOP so it probably doesn't matter much.

That option is enabled by most distributions that enable SELinux; it is what enables support for permissive mode.

Quoted 26 lines
 security/selinux/selinuxfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/selinuxfs.c +1 -1
index 1684bcc..5fde343 100644
@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
 		goto out;
 
 	/* No partial writes. */
-	length = EINVAL;
+	length = -EINVAL;
 	if (*ppos != 0)
 		goto out;
 

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

maintainer
#2 lore raw
In reply to Joe Perches
Quoted 11 lines · Joe Perches

Return a negative error value like the rest of the entries in this function.

---
Maybe this should be stable, it goes back to commit b77a493b1dc8 ("SELinux: standardize return code handling in selinuxfs.c") back in Nov 2010, but it's guarded by a #ifdef CONFIG_SECURITY_SELINUX_DEVELOP so it probably doesn't matter much.

Quoted 2 lines
 security/selinux/selinuxfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

My apologies, I hit reply and not reply-all to Stephen's ACK mentioning that it might take me a day or two to merge this ... regardless, it's merged now and marked for -stable; I also just sent a pull request to James with this patch for v3.20.

Thanks for the fix.

Quoted 15 lines
security/selinux/selinuxfs.c +1 -1
index 1684bcc..5fde343 100644
@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
                goto out;
 
        /* No partial writes. */
-       length = EINVAL;
+       length = -EINVAL;
        if (*ppos != 0)
                goto out;
 
Signature · 2 lines
paul moore
www.paul-moore.com