All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] selinux: Fix error return code in policydb_read()
@ 2019-01-18 14:23 ` Wei Yongjun
  0 siblings, 0 replies; 38+ messages in thread
From: Wei Yongjun @ 2019-01-18 14:23 UTC (permalink / raw)
  To: Paul Moore, Stephen Smalley, Eric Paris, peter enderborg,
	Kent Overstreet, Tetsuo Handa, Ondrej Mosnacek, Andrew Morton,
	Stephen Rothwell
  Cc: Wei Yongjun, selinux, kernel-janitors

Fix to return a negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 31696241e96e ("selinux: convert to kvmalloc")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 security/selinux/ss/policydb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 6b576e5..ef616dd 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -2490,6 +2490,7 @@ int policydb_read(struct policydb *p, void *fp)
 	if (rc)
 		goto bad;
 
+	rc = -ENOMEM;
 	p->type_attr_map_array = kvcalloc(p->p_types.nprim,
 					  sizeof(*p->type_attr_map_array),
 					  GFP_KERNEL);

^ permalink raw reply related	[flat|nested] 38+ messages in thread
* [PATCH -next] SELinux: fix error return code in policydb_read()
@ 2016-09-10  7:43 Wei Yongjun
  2016-09-13 21:19 ` Paul Moore
  0 siblings, 1 reply; 38+ messages in thread
From: Wei Yongjun @ 2016-09-10  7:43 UTC (permalink / raw)
  To: Paul Moore, Stephen Smalley, Eric Paris, James Morris,
	Serge E. Hallyn, William Roberts
  Cc: Wei Yongjun, selinux, linux-security-module

From: Wei Yongjun <weiyongjun1@huawei.com>

Fix to return error code -EINVAL from the error handling case instead
of 0(rc is overwrite to 0 when policyvers >= POLICYDB_VERSION_ROLETRANS),
as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 security/selinux/ss/policydb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 8c661f0..ace6838 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -2417,6 +2417,7 @@ int policydb_read(struct policydb *p, void *fp)
 		} else
 			tr->tclass = p->process_class;
 
+		rc = -EINVAL;
 		if (!policydb_role_isvalid(p, tr->role) ||
 		    !policydb_type_isvalid(p, tr->type) ||
 		    !policydb_class_isvalid(p, tr->tclass) ||

^ permalink raw reply related	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2020-05-04 19:19 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-18 14:23 [PATCH -next] selinux: Fix error return code in policydb_read() Wei Yongjun
2019-01-18 14:23 ` Wei Yongjun
2019-01-18 21:28 ` Paul Moore
2019-01-18 21:28   ` Paul Moore
2019-01-19  0:21   ` Stephen Rothwell
2019-01-19  0:21     ` Stephen Rothwell
2019-01-20 20:04     ` Stephen Rothwell
2019-01-20 20:04       ` Stephen Rothwell
2019-01-22 17:39       ` Paul Moore
2019-01-22 17:39         ` Paul Moore
2019-01-25 21:59         ` Paul Moore
2019-01-25 21:59           ` Paul Moore
2020-04-27 12:49 ` [PATCH -next] selinux: fix error return code in cond_read_list() Wei Yongjun
2020-04-27 12:49   ` Wei Yongjun
2020-04-27 13:32   ` Ondrej Mosnacek
2020-04-27 13:32     ` Ondrej Mosnacek
2020-04-27 21:59   ` Paul Moore
2020-04-27 21:59     ` Paul Moore
2020-04-29  7:30 ` [PATCH -next] selinux: fix error return code in policydb_read() Wei Yongjun
2020-04-29  7:30   ` Wei Yongjun
2020-04-29 13:07   ` Dan Carpenter
2020-04-29 13:07     ` Dan Carpenter
2020-04-29 13:32     ` Ondrej Mosnacek
2020-04-29 13:32       ` Ondrej Mosnacek
2020-04-29 13:47       ` Dan Carpenter
2020-04-29 13:47         ` Dan Carpenter
2020-05-01 19:08       ` Paul Moore
2020-05-01 19:08         ` Paul Moore
2020-05-01 19:52         ` Ondrej Mosnacek
2020-05-01 19:52           ` Ondrej Mosnacek
2020-05-01 16:46     ` Paul Moore
2020-05-01 16:46       ` Paul Moore
2020-05-04 19:17       ` Dan Carpenter
2020-05-04 19:17         ` Dan Carpenter
2020-05-01 19:04   ` Paul Moore
2020-05-01 19:04     ` Paul Moore
  -- strict thread matches above, loose matches on Subject: below --
2016-09-10  7:43 [PATCH -next] SELinux: " Wei Yongjun
2016-09-13 21:19 ` Paul Moore

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.