diff mbox series

[-next] selinux: Fix error return code in policydb_read()

Message ID 1547821427-157169-1-git-send-email-weiyongjun1@huawei.com (mailing list archive)
State Awaiting Upstream
Headers show
Series [-next] selinux: Fix error return code in policydb_read() | expand

Commit Message

Wei Yongjun Jan. 18, 2019, 2:23 p.m. UTC
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(+)

Comments

Paul Moore Jan. 18, 2019, 9:28 p.m. UTC | #1
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);
>
>
>
Stephen Rothwell Jan. 19, 2019, 12:21 a.m. UTC | #2
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.
Stephen Rothwell Jan. 20, 2019, 8:04 p.m. UTC | #3
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.
Paul Moore Jan. 22, 2019, 5:39 p.m. UTC | #4
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 Jan. 25, 2019, 9:59 p.m. UTC | #5
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?
diff mbox series

Patch

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