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

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