Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752905AbcDZXLS (ORCPT ); Tue, 26 Apr 2016 19:11:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54308 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752147AbcDZXLQ (ORCPT ); Tue, 26 Apr 2016 19:11:16 -0400 Date: Tue, 26 Apr 2016 16:11:15 -0700 From: Greg Kroah-Hartman To: Alan Stern Cc: Chunfeng Yun , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence Message-ID: <20160426231115.GB23273@kroah.com> References: <20160408140701.GA3547@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 745 Lines: 22 On Fri, Apr 08, 2016 at 11:21:05AM -0400, Alan Stern wrote: > On Fri, 8 Apr 2016, Greg Kroah-Hartman wrote: > > > On Fri, Apr 08, 2016 at 05:08:03PM +0800, Chunfeng Yun wrote: > > > NULL pointer dereferrence will happen when class driver > > > wants to allocate zero length buffer and pool_max[0] > > > can't be used, so skip reserved pool in this case. > > > > Why would a driver want to allocate a 0 length buffer? What driver does > > this? > > > > Shouldn't we fix that issue instead? > > And even if a driver does want to allocate a 0-length buffer, shouldn't > the function simply return early instead of running through all its > calculations? Yes it should, Chunfeng, can you fix this patch to do that please. thanks, greg k-h