Re: [PATCH] hooks: fix a missing-check bug in selinux_add_mnt_opt()

2019-05-30 Thread Gen Zhang
On Thu, May 30, 2019 at 12:22:15PM +0300, Sergei Shtylyov wrote: > On 30.05.2019 12:18, Gen Zhang wrote: > > >>On 30.05.2019 11:06, Gen Zhang wrote: > >> > >>>In selinux_add_mnt_opt(), 'val' is allcoted by kmemdup_nul(). It returns > >> > >>Allocated? > > >Thanks for your reply, Sergei. I use

Re: [PATCH] hooks: fix a missing-check bug in selinux_add_mnt_opt()

2019-05-30 Thread Sergei Shtylyov
On 30.05.2019 12:18, Gen Zhang wrote: On 30.05.2019 11:06, Gen Zhang wrote: In selinux_add_mnt_opt(), 'val' is allcoted by kmemdup_nul(). It returns Allocated? Thanks for your reply, Sergei. I used 'allocated' because kmemdup_nul() does some allocation in its implementation. And its d

Re: [PATCH] hooks: fix a missing-check bug in selinux_add_mnt_opt()

2019-05-30 Thread Gen Zhang
On Thu, May 30, 2019 at 12:11:33PM +0300, Sergei Shtylyov wrote: > Hello! > > On 30.05.2019 11:06, Gen Zhang wrote: > > >In selinux_add_mnt_opt(), 'val' is allcoted by kmemdup_nul(). It returns > >Allocated? Thanks for your reply, Sergei. I used 'allocated' because kmemdup_nul() does some al

Re: [PATCH] hooks: fix a missing-check bug in selinux_add_mnt_opt()

2019-05-30 Thread Sergei Shtylyov
Hello! On 30.05.2019 11:06, Gen Zhang wrote: In selinux_add_mnt_opt(), 'val' is allcoted by kmemdup_nul(). It returns Allocated? NULL when fails. So 'val' should be checked. Signed-off-by: Gen Zhang [...] MBR, Sergei

Re: [PATCH] hooks: fix a missing-check bug in selinux_add_mnt_opt()

2019-05-30 Thread Ondrej Mosnacek
On Thu, May 30, 2019 at 10:06 AM Gen Zhang wrote: > In selinux_add_mnt_opt(), 'val' is allcoted by kmemdup_nul(). It returns > NULL when fails. So 'val' should be checked. > > Signed-off-by: Gen Zhang Please add a Fixes tag here, too: Fixes: 757cbe597fe8 ("LSM: new method: ->sb_add_mnt_opt()")

[PATCH] hooks: fix a missing-check bug in selinux_add_mnt_opt()

2019-05-30 Thread Gen Zhang
In selinux_add_mnt_opt(), 'val' is allcoted by kmemdup_nul(). It returns NULL when fails. So 'val' should be checked. Signed-off-by: Gen Zhang --- diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 3ec702c..4797c63 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/h