Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752426AbcD0BcU (ORCPT ); Tue, 26 Apr 2016 21:32:20 -0400 Received: from mailgw02.mediatek.com ([218.249.47.111]:57954 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752266AbcD0BcS (ORCPT ); Tue, 26 Apr 2016 21:32:18 -0400 Message-ID: <1461720730.11651.4.camel@mhfsdcap03> Subject: Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence From: chunfeng yun To: Greg Kroah-Hartman CC: Alan Stern , , , , Date: Wed, 27 Apr 2016 09:32:10 +0800 In-Reply-To: <20160426231115.GB23273@kroah.com> References: <20160408140701.GA3547@kroah.com> <20160426231115.GB23273@kroah.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 881 Lines: 28 Hi, On Tue, 2016-04-26 at 16:11 -0700, Greg Kroah-Hartman wrote: > 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. > Ok, I will fix it later > thanks, > > greg k-h