public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] cifs: integer overflow in parse_dacl()
@ 2012-01-11  7:46 Dan Carpenter
       [not found] ` <20120111074627.GA4519-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2012-01-11  7:46 UTC (permalink / raw)
  To: Steve French
  Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
leading to a smaller ppace buffer than we expected.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 72ddf23..c1b2544 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
 		umode_t group_mask = S_IRWXG;
 		umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
 
+		if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
+			return;
 		ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
 				GFP_KERNEL);
 		if (!ppace) {

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

* Re: [patch] cifs: integer overflow in parse_dacl()
       [not found] ` <20120111074627.GA4519-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
@ 2012-01-11 12:20   ` Jeff Layton
       [not found]     ` <20120111072029.672dfdca-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
  2012-01-11 15:50   ` Shirish Pargaonkar
  2012-01-12 19:17   ` Steve French
  2 siblings, 1 reply; 10+ messages in thread
From: Jeff Layton @ 2012-01-11 12:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Wed, 11 Jan 2012 10:46:27 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
> leading to a smaller ppace buffer than we expected.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
> index 72ddf23..c1b2544 100644
> --- a/fs/cifs/cifsacl.c
> +++ b/fs/cifs/cifsacl.c
> @@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
>  		umode_t group_mask = S_IRWXG;
>  		umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
>  
> +		if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
> +			return;
>  		ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
>  				GFP_KERNEL);
>  		if (!ppace) {


Looks plausible. This function could use some work. I'm not sure why
num_aces is signed here too...

The first arg to kmalloc is a size_t. Does that boil down to an unsigned
long on all arches?

-- 
Jeff Layton <jlayton@samba.org>

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

* Re: [patch] cifs: integer overflow in parse_dacl()
       [not found]     ` <20120111072029.672dfdca-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
@ 2012-01-11 12:41       ` Dan Carpenter
  2012-01-11 13:33         ` Jeff Layton
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2012-01-11 12:41 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Steve French, linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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

On Wed, Jan 11, 2012 at 07:20:29AM -0500, Jeff Layton wrote:
> On Wed, 11 Jan 2012 10:46:27 +0300
> Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> > On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
> > leading to a smaller ppace buffer than we expected.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
> > index 72ddf23..c1b2544 100644
> > --- a/fs/cifs/cifsacl.c
> > +++ b/fs/cifs/cifsacl.c
> > @@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
> >  		umode_t group_mask = S_IRWXG;
> >  		umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
> >  
> > +		if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
> > +			return;
> >  		ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
> >  				GFP_KERNEL);
> >  		if (!ppace) {
> 
> 
> Looks plausible. This function could use some work. I'm not sure why
> num_aces is signed here too...
> 
> The first arg to kmalloc is a size_t. Does that boil down to an unsigned
> long on all arches?

People have been submitting a lot of patches recently based on that
assumption.  It matches the check in kcalloc() as well.  According
to include/asm-generic/posix_types.h:

/*
 * Most 32 bit architectures use "unsigned int" size_t,
 * and all 64 bit architectures use "unsigned long" size_t.
 */

It would be better to user a lower limit, but I don't know the code
well enough to say if which one is good that won't break things...
A high number can trigger a kmalloc() failure and that puts annoying
spam in the dmesg.

regards,
dan carpenter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [patch] cifs: integer overflow in parse_dacl()
  2012-01-11 12:41       ` Dan Carpenter
@ 2012-01-11 13:33         ` Jeff Layton
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Layton @ 2012-01-11 13:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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

On Wed, 11 Jan 2012 15:41:32 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On Wed, Jan 11, 2012 at 07:20:29AM -0500, Jeff Layton wrote:
> > On Wed, 11 Jan 2012 10:46:27 +0300
> > Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > 
> > > On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
> > > leading to a smaller ppace buffer than we expected.
> > > 
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > 
> > > diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
> > > index 72ddf23..c1b2544 100644
> > > --- a/fs/cifs/cifsacl.c
> > > +++ b/fs/cifs/cifsacl.c
> > > @@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
> > >  		umode_t group_mask = S_IRWXG;
> > >  		umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
> > >  
> > > +		if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
> > > +			return;
> > >  		ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
> > >  				GFP_KERNEL);
> > >  		if (!ppace) {
> > 
> > 
> > Looks plausible. This function could use some work. I'm not sure why
> > num_aces is signed here too...
> > 
> > The first arg to kmalloc is a size_t. Does that boil down to an unsigned
> > long on all arches?
> 
> People have been submitting a lot of patches recently based on that
> assumption.  It matches the check in kcalloc() as well.  According
> to include/asm-generic/posix_types.h:
> 
> /*
>  * Most 32 bit architectures use "unsigned int" size_t,
>  * and all 64 bit architectures use "unsigned long" size_t.
>  */
> 
> It would be better to user a lower limit, but I don't know the code
> well enough to say if which one is good that won't break things...
> A high number can trigger a kmalloc() failure and that puts annoying
> spam in the dmesg.
> 
> regards,
> dan carpenter

Ok, thanks. In that case...

Acked-by: Jeff Layton <jlayton@samba.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [patch] cifs: integer overflow in parse_dacl()
       [not found] ` <20120111074627.GA4519-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  2012-01-11 12:20   ` Jeff Layton
@ 2012-01-11 15:50   ` Shirish Pargaonkar
       [not found]     ` <CADT32eLVwQT9V67BX8TkjVHDnQoYS7OqA_-xbnjY57ZXO3EfsA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2012-01-12 19:17   ` Steve French
  2 siblings, 1 reply; 10+ messages in thread
From: Shirish Pargaonkar @ 2012-01-11 15:50 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Wed, Jan 11, 2012 at 1:46 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
> leading to a smaller ppace buffer than we expected.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
> index 72ddf23..c1b2544 100644
> --- a/fs/cifs/cifsacl.c
> +++ b/fs/cifs/cifsacl.c
> @@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
>                umode_t group_mask = S_IRWXG;
>                umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
>
> +               if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))

Should an error/warning (like cifs client can't handle these many aces or
possible erroneous number of aces sent by server etc.) be logged before
returning?

> +                       return;
>                ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
>                                GFP_KERNEL);
>                if (!ppace) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] cifs: integer overflow in parse_dacl()
       [not found]     ` <CADT32eLVwQT9V67BX8TkjVHDnQoYS7OqA_-xbnjY57ZXO3EfsA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-01-11 17:24       ` Steve French
       [not found]         ` <CAH2r5muDQUL=0HcoFHH3QvP7C2pyy0=S9ESFBcm=qOYg3ESdxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Steve French @ 2012-01-11 17:24 UTC (permalink / raw)
  To: Shirish Pargaonkar
  Cc: Dan Carpenter, Steve French, linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Wed, Jan 11, 2012 at 9:50 AM, Shirish Pargaonkar
<shirishpargaonkar@gmail.com> wrote:
> On Wed, Jan 11, 2012 at 1:46 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>> On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
>> leading to a smaller ppace buffer than we expected.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>
>> diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
>> index 72ddf23..c1b2544 100644
>> --- a/fs/cifs/cifsacl.c
>> +++ b/fs/cifs/cifsacl.c
>> @@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
>>                umode_t group_mask = S_IRWXG;
>>                umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
>>
>> +               if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
>
> Should an error/warning (like cifs client can't handle these many aces or
> possible erroneous number of aces sent by server etc.) be logged before
> returning?
>
>> +                       return;
>>                ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
>>                                GFP_KERNEL);
>>                if (!ppace) {

Perhaps.   Also note that you would overflow maximum smb size if num
aces is huge
so would you have even gotten this far?

-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] cifs: integer overflow in parse_dacl()
       [not found]         ` <CAH2r5muDQUL=0HcoFHH3QvP7C2pyy0=S9ESFBcm=qOYg3ESdxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-01-11 18:20           ` Jeff Layton
       [not found]             ` <20120111132053.467e8cae-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff Layton @ 2012-01-11 18:20 UTC (permalink / raw)
  To: Steve French
  Cc: Shirish Pargaonkar, Dan Carpenter, Steve French,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Wed, 11 Jan 2012 11:24:03 -0600
Steve French <smfrench@gmail.com> wrote:

> On Wed, Jan 11, 2012 at 9:50 AM, Shirish Pargaonkar
> <shirishpargaonkar@gmail.com> wrote:
> > On Wed, Jan 11, 2012 at 1:46 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >> On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
> >> leading to a smaller ppace buffer than we expected.
> >>
> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >>
> >> diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
> >> index 72ddf23..c1b2544 100644
> >> --- a/fs/cifs/cifsacl.c
> >> +++ b/fs/cifs/cifsacl.c
> >> @@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
> >>                umode_t group_mask = S_IRWXG;
> >>                umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
> >>
> >> +               if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
> >
> > Should an error/warning (like cifs client can't handle these many aces or
> > possible erroneous number of aces sent by server etc.) be logged before
> > returning?
> >
> >> +                       return;
> >>                ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
> >>                                GFP_KERNEL);
> >>                if (!ppace) {
> 
> Perhaps.   Also note that you would overflow maximum smb size if num
> aces is huge
> so would you have even gotten this far?
> 

Only if the smb frame is properly formed. It's possible that it's
corrupt in such a way that the num_aces field is much larger than it
should be, but the rest of the frame looks OK.

-- 
Jeff Layton <jlayton@samba.org>

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

* Re: [patch] cifs: integer overflow in parse_dacl()
       [not found]             ` <20120111132053.467e8cae-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
@ 2012-01-11 18:31               ` Steve French
       [not found]                 ` <CAH2r5msciOkxvxTrQrN9mKKCiJvM_anmxU7sag_TGk92LoKEwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Steve French @ 2012-01-11 18:31 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Shirish Pargaonkar, Dan Carpenter, Steve French,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

We could calculate max_aces based on a minimum sized ace and maximum
smb frame size (which would be 64K presumably for Windows for
non-Writes, but larger for Samba), but not sure if it is worth the
trouble unless you find a path where we would parse beyond end of
frame,

On Wed, Jan 11, 2012 at 12:20 PM, Jeff Layton <jlayton@samba.org> wrote:
> On Wed, 11 Jan 2012 11:24:03 -0600
> Steve French <smfrench@gmail.com> wrote:
>
>> On Wed, Jan 11, 2012 at 9:50 AM, Shirish Pargaonkar
>> <shirishpargaonkar@gmail.com> wrote:
>> > On Wed, Jan 11, 2012 at 1:46 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>> >> On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
>> >> leading to a smaller ppace buffer than we expected.
>> >>
>> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> >>
>> >> diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
>> >> index 72ddf23..c1b2544 100644
>> >> --- a/fs/cifs/cifsacl.c
>> >> +++ b/fs/cifs/cifsacl.c
>> >> @@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
>> >>                umode_t group_mask = S_IRWXG;
>> >>                umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
>> >>
>> >> +               if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
>> >
>> > Should an error/warning (like cifs client can't handle these many aces or
>> > possible erroneous number of aces sent by server etc.) be logged before
>> > returning?
>> >
>> >> +                       return;
>> >>                ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
>> >>                                GFP_KERNEL);
>> >>                if (!ppace) {
>>
>> Perhaps.   Also note that you would overflow maximum smb size if num
>> aces is huge
>> so would you have even gotten this far?
>>
>
> Only if the smb frame is properly formed. It's possible that it's
> corrupt in such a way that the num_aces field is much larger than it
> should be, but the rest of the frame looks OK.
>
> --
> Jeff Layton <jlayton@samba.org>



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] cifs: integer overflow in parse_dacl()
       [not found]                 ` <CAH2r5msciOkxvxTrQrN9mKKCiJvM_anmxU7sag_TGk92LoKEwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-01-12  7:06                   ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2012-01-12  7:06 UTC (permalink / raw)
  To: Steve French
  Cc: Jeff Layton, Shirish Pargaonkar, Steve French,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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

On Wed, Jan 11, 2012 at 12:31:34PM -0600, Steve French wrote:
> We could calculate max_aces based on a minimum sized ace and maximum
> smb frame size (which would be 64K presumably for Windows for
> non-Writes, but larger for Samba), but not sure if it is worth the
> trouble unless you find a path where we would parse beyond end of
> frame,

This was a static checker test and I haven't tried to exploit it.
You guys are more familiar with the code obviously and you've lost
me with the talk about max_aces.  I don't see that anywhere in the
code...

$ grep max_aces fs/cifs/ -iR | wc -l
0

regards,
dan carpenter



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [patch] cifs: integer overflow in parse_dacl()
       [not found] ` <20120111074627.GA4519-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  2012-01-11 12:20   ` Jeff Layton
  2012-01-11 15:50   ` Shirish Pargaonkar
@ 2012-01-12 19:17   ` Steve French
  2 siblings, 0 replies; 10+ messages in thread
From: Steve French @ 2012-01-12 19:17 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

Merged into cifs-2.6.git

On Wed, Jan 11, 2012 at 1:46 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On 32 bit systems num_aces * sizeof(struct cifs_ace *) could overflow
> leading to a smaller ppace buffer than we expected.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
> index 72ddf23..c1b2544 100644
> --- a/fs/cifs/cifsacl.c
> +++ b/fs/cifs/cifsacl.c
> @@ -909,6 +909,8 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
>                umode_t group_mask = S_IRWXG;
>                umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
>
> +               if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
> +                       return;
>                ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
>                                GFP_KERNEL);
>                if (!ppace) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2012-01-12 19:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11  7:46 [patch] cifs: integer overflow in parse_dacl() Dan Carpenter
     [not found] ` <20120111074627.GA4519-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2012-01-11 12:20   ` Jeff Layton
     [not found]     ` <20120111072029.672dfdca-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2012-01-11 12:41       ` Dan Carpenter
2012-01-11 13:33         ` Jeff Layton
2012-01-11 15:50   ` Shirish Pargaonkar
     [not found]     ` <CADT32eLVwQT9V67BX8TkjVHDnQoYS7OqA_-xbnjY57ZXO3EfsA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-11 17:24       ` Steve French
     [not found]         ` <CAH2r5muDQUL=0HcoFHH3QvP7C2pyy0=S9ESFBcm=qOYg3ESdxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-11 18:20           ` Jeff Layton
     [not found]             ` <20120111132053.467e8cae-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2012-01-11 18:31               ` Steve French
     [not found]                 ` <CAH2r5msciOkxvxTrQrN9mKKCiJvM_anmxU7sag_TGk92LoKEwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-12  7:06                   ` Dan Carpenter
2012-01-12 19:17   ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox