SELinux Archive on lore.kernel.org
 help / Atom feed
* [PATCH -next] selinux: Fix error return code in policydb_read()
@ 2019-01-18 14:23 Wei Yongjun
  2019-01-18 21:28 ` Paul Moore
  0 siblings, 1 reply; 8+ 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	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] selinux: Fix error return code in policydb_read()
  2019-01-18 14:23 [PATCH -next] selinux: Fix error return code in policydb_read() Wei Yongjun
@ 2019-01-18 21:28 ` Paul Moore
  2019-01-19  0:21   ` Stephen Rothwell
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Moore @ 2019-01-18 21:28 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Stephen Smalley, Eric Paris, peter enderborg, Kent Overstreet,
	Tetsuo Handa, Ondrej Mosnacek, Andrew Morton, Stephen Rothwell,
	selinux, kernel-janitors

On Fri, Jan 18, 2019 at 9:18 AM Wei Yongjun <weiyongjun1@huawei.com> wrote:
>
> 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")

Unfortunately this commit isn't to be found in any of the SELinux
branches, or Linus' master branch; based on the subject line I'm
guessing the original patch is in a -next branch somewhere.  Please
find whoever pushed this patch to linux-next and have them apply the
fix.

Thank you.

> 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);
>
>
>

-- 
paul moore
www.paul-moore.com

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

* Re: [PATCH -next] selinux: Fix error return code in policydb_read()
  2019-01-18 21:28 ` Paul Moore
@ 2019-01-19  0:21   ` Stephen Rothwell
  2019-01-20 20:04     ` Stephen Rothwell
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Rothwell @ 2019-01-19  0:21 UTC (permalink / raw)
  To: Paul Moore
  Cc: Wei Yongjun, Stephen Smalley, Eric Paris, peter enderborg,
	Kent Overstreet, Tetsuo Handa, Ondrej Mosnacek, Andrew Morton,
	selinux, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

Hi Paul,

On Fri, 18 Jan 2019 16:28:07 -0500 Paul Moore <paul@paul-moore.com> wrote:
>
> On Fri, Jan 18, 2019 at 9:18 AM Wei Yongjun <weiyongjun1@huawei.com> wrote:
> >
> > 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")  
> 
> Unfortunately this commit isn't to be found in any of the SELinux
> branches, or Linus' master branch; based on the subject line I'm
> guessing the original patch is in a -next branch somewhere.  Please
> find whoever pushed this patch to linux-next and have them apply the
> fix.

Yeah, Kent has a series doing conversions that is in Andrew Morton's
mmotm patch series.
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH -next] selinux: Fix error return code in policydb_read()
  2019-01-19  0:21   ` Stephen Rothwell
@ 2019-01-20 20:04     ` Stephen Rothwell
  2019-01-22 17:39       ` Paul Moore
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Rothwell @ 2019-01-20 20:04 UTC (permalink / raw)
  To: Paul Moore
  Cc: Wei Yongjun, Stephen Smalley, Eric Paris, peter enderborg,
	Kent Overstreet, Tetsuo Handa, Ondrej Mosnacek, Andrew Morton,
	selinux, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

Hi all,

On Sat, 19 Jan 2019 11:21:48 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> On Fri, 18 Jan 2019 16:28:07 -0500 Paul Moore <paul@paul-moore.com> wrote:
> >
> > On Fri, Jan 18, 2019 at 9:18 AM Wei Yongjun <weiyongjun1@huawei.com> wrote:  
> > >
> > > 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")    
> > 
> > Unfortunately this commit isn't to be found in any of the SELinux
> > branches, or Linus' master branch; based on the subject line I'm
> > guessing the original patch is in a -next branch somewhere.  Please
> > find whoever pushed this patch to linux-next and have them apply the
> > fix.  
> 
> Yeah, Kent has a series doing conversions that is in Andrew Morton's
> mmotm patch series.

I have added that patch to the akpm-current tree in linux-next from today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH -next] selinux: Fix error return code in policydb_read()
  2019-01-20 20:04     ` Stephen Rothwell
@ 2019-01-22 17:39       ` Paul Moore
  2019-01-25 21:59         ` Paul Moore
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Moore @ 2019-01-22 17:39 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Wei Yongjun, Stephen Smalley, Eric Paris, peter enderborg,
	Kent Overstreet, Tetsuo Handa, Ondrej Mosnacek, Andrew Morton,
	selinux, kernel-janitors

On Sun, Jan 20, 2019 at 3:04 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi all,
>
> On Sat, 19 Jan 2019 11:21:48 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > On Fri, 18 Jan 2019 16:28:07 -0500 Paul Moore <paul@paul-moore.com> wrote:
> > >
> > > On Fri, Jan 18, 2019 at 9:18 AM Wei Yongjun <weiyongjun1@huawei.com> wrote:
> > > >
> > > > 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")
> > >
> > > Unfortunately this commit isn't to be found in any of the SELinux
> > > branches, or Linus' master branch; based on the subject line I'm
> > > guessing the original patch is in a -next branch somewhere.  Please
> > > find whoever pushed this patch to linux-next and have them apply the
> > > fix.
> >
> > Yeah, Kent has a series doing conversions that is in Andrew Morton's
> > mmotm patch series.
>
> I have added that patch to the akpm-current tree in linux-next from today.

Thanks Stephen.

Wei Yongjun, have you talked with Kent and/or Andrew about getting
your fix added to their tree?  It's good that Stephen picked it up,
but it needs to get added to the original set of patches so the fix
makes it's way into Linus' tree at the same time as the original
patches.

-- 
paul moore
www.paul-moore.com

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

* Re: [PATCH -next] selinux: Fix error return code in policydb_read()
  2019-01-22 17:39       ` Paul Moore
@ 2019-01-25 21:59         ` Paul Moore
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Moore @ 2019-01-25 21:59 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Stephen Smalley, Eric Paris, peter enderborg, Kent Overstreet,
	Stephen Rothwell, Tetsuo Handa, Ondrej Mosnacek, Andrew Morton,
	selinux, kernel-janitors

On Tue, Jan 22, 2019 at 12:39 PM Paul Moore <paul@paul-moore.com> wrote:
>
> On Sun, Jan 20, 2019 at 3:04 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > Hi all,
> >
> > On Sat, 19 Jan 2019 11:21:48 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > >
> > > On Fri, 18 Jan 2019 16:28:07 -0500 Paul Moore <paul@paul-moore.com> wrote:
> > > >
> > > > On Fri, Jan 18, 2019 at 9:18 AM Wei Yongjun <weiyongjun1@huawei.com> wrote:
> > > > >
> > > > > 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")
> > > >
> > > > Unfortunately this commit isn't to be found in any of the SELinux
> > > > branches, or Linus' master branch; based on the subject line I'm
> > > > guessing the original patch is in a -next branch somewhere.  Please
> > > > find whoever pushed this patch to linux-next and have them apply the
> > > > fix.
> > >
> > > Yeah, Kent has a series doing conversions that is in Andrew Morton's
> > > mmotm patch series.
> >
> > I have added that patch to the akpm-current tree in linux-next from today.
>
> Thanks Stephen.
>
> Wei Yongjun, have you talked with Kent and/or Andrew about getting
> your fix added to their tree?  It's good that Stephen picked it up,
> but it needs to get added to the original set of patches so the fix
> makes it's way into Linus' tree at the same time as the original
> patches.

Wei Yongjun, any progress on this?

-- 
paul moore
www.paul-moore.com

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

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

On Sat, Sep 10, 2016 at 3:43 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> 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(+)

Nice catch, thanks for the patch; it has been merged into the
selinux#next branch.

> 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) ||
>

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 8+ 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; 8+ 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	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ 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 21:28 ` Paul Moore
2019-01-19  0:21   ` Stephen Rothwell
2019-01-20 20:04     ` Stephen Rothwell
2019-01-22 17:39       ` Paul Moore
2019-01-25 21:59         ` Paul Moore
  -- strict thread matches above, loose matches on Subject: below --
2016-09-10  7:43 [PATCH -next] SELinux: fix " Wei Yongjun
2016-09-13 21:19 ` Paul Moore

SELinux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux/0 selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ https://lore.kernel.org/selinux \
		selinux@vger.kernel.org selinux@archiver.kernel.org
	public-inbox-index selinux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox