Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752941AbbBWVQM (ORCPT ); Mon, 23 Feb 2015 16:16:12 -0500 Received: from fieldses.org ([173.255.197.46]:52110 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751861AbbBWVQK (ORCPT ); Mon, 23 Feb 2015 16:16:10 -0500 Date: Mon, 23 Feb 2015 16:16:07 -0500 To: Dan Carpenter Cc: "Eric W. Biederman" , Andrew Morton , Andy Lutomirski , Wang YanQing , linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [patch] groups: integer underflow in groups_alloc() Message-ID: <20150223211607.GB28635@fieldses.org> References: <20150223154419.GA2542@mwanda> <87385w1rmd.fsf@x220.int.ebiederm.org> <20150223180326.GC5116@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150223180326.GC5116@mwanda> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1361 Lines: 33 On Mon, Feb 23, 2015 at 09:03:27PM +0300, Dan Carpenter wrote: > On Mon, Feb 23, 2015 at 11:10:02AM -0600, Eric W. Biederman wrote: > > Dan Carpenter writes: > > > > > This is called from rsc_parse() with a use controlled value. Say for > > > example that "gidsetsize" is negative, then we could end up allocating > > > less than sizeof(struct group_info) leading to memory corruption. > > > > Right now it is the responsibility of the caller of groups_alloc to make > > certain that gidsetsize is a valid value, and the callers of > > groups_alloc who know what they are doing already validate this value. > > > > Either the pattern of caller validates the messages needs to continue, > > or groups_alloc needs to be changed and all of the callers need to be > > updated. > > > > Changing groups_alloc for one particular caller is just going to cause > > maintenance problems. > > > > This only affects NFS so let's hear from them if this limit is correct > and decide from there. I think that's probably the correct check, sure. Putting it in rsc_parse sounds reasonable. --b. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/