Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753578AbcDKI02 (ORCPT ); Mon, 11 Apr 2016 04:26:28 -0400 Received: from mga01.intel.com ([192.55.52.88]:24576 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753259AbcDKI0Z (ORCPT ); Mon, 11 Apr 2016 04:26:25 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,462,1455004800"; d="asc'?scan'208";a="942557375" From: Felipe Balbi To: chunfeng yun Cc: Greg Kroah-Hartman , 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 In-Reply-To: <1460358968.10419.26.camel@mhfsdcap03> References: <1460106483-24793-1-git-send-email-chunfeng.yun@mediatek.com> <20160408140701.GA3547@kroah.com> <1460343705.10419.12.camel@mhfsdcap03> <87shyspwbz.fsf@intel.com> <1460358968.10419.26.camel@mhfsdcap03> User-Agent: Notmuch/0.21+96~g9bbc54b (http://notmuchmail.org) Emacs/25.0.90.3 (x86_64-pc-linux-gnu) Date: Mon, 11 Apr 2016 11:24:22 +0300 Message-ID: <87y48ko8nd.fsf@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1891 Lines: 53 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, chunfeng yun writes: >> > On Fri, 2016-04-08 at 07:07 -0700, 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. >> >>=20 >> >> Why would a driver want to allocate a 0 length buffer? What driver d= oes >> >> this? >> > It's misc/usbtest.c >>=20 >> that'll do what you ask it to do with the userspace tool testusb. Are >> you trying to pass a size of 0 ? >>=20 > No, I just ran "testusb -t10" which called test_ctrl_queue(). > In this function, sub-case 8 passed a parameter @len as 0 to > simple_alloc_urb(), and then it tried to allocate a 0-length buffer. odd, I have never seen this problem running testusb with the same arguments. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXC182AAoJEIaOsuA1yqREIRcP/14TqylKGQ0vf80Xt3j/gxaX 5Nus+jaHazLF23QOsNzIRL8Sg3YUTOIzLdehwYZdMtq4dcvM6p6Knc4wcgOoAxnP 5gV/qPqnoYvaXmmP4M543tqexfz4rBmbnH6n1QxVcPQW4yiZBWrd8LUgfxOfThD4 4OgDsZyCBjRuEbho8ewZYuN9l4jhkU1eD0mY9DLlQ1KIAxRI14kRMCNdxpJ+XCDQ +TmMc9mMPNe7BirCR+VtKww8JTobq6bD0yP3kZq2xyjRk+yV+tlwd9OPSwbpdAmf tpF1ZxJhu5XWMMI55BT9Fv9w7CAGZUJ3482UMBnMobesj2bBK4IWkdjpqRe5bk52 Ad8UV/KkLlMUUt8V2uhxQ4JtzVJuZ2kOK62I8UUCdY3V5iJzsrZnus5xdKylqCTs ilX9Wynnxa1KLQ2iF+RoRv1lOnqSTrurP3IAQJP65YvJ9TXiGMhHt6gVJB+sPJQU JkO3zYclj7NDHWlUv8ilmQDF4stQn0HqCmS16iGSkQ1Dzqw7Q5+n4fQLqvfmLRwZ qEFZRSrJKpQB3giqTZC0mJnWP0roXENFHor7tGm+eP4scFLPlAXiCkIupfHIks4H 2nwx7o939u0izVUg7ooqPSUKPhCsrf2EugRazdWIqZec8AwrSGyr3v6epyiBYcJE Gr6HBWB00oVF1FhvYZcz =OkB2 -----END PGP SIGNATURE----- --=-=-=--