Received: from eggs.gnu.org ([2001:4830:134:3::10]:43735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1uY1-0003p3-Hf for qemu-devel@nongnu.org; Wed, 02 Nov 2016 08:21:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1uXx-0002Cv-JY for qemu-devel@nongnu.org; Wed, 02 Nov 2016 08:21:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35666) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c1uXx-0002Cp-E2 for qemu-devel@nongnu.org; Wed, 02 Nov 2016 08:21:37 -0400 From: Markus Armbruster References: <1476859665-30133-1-git-send-email-caoj.fnst@cn.fujitsu.com> <1476859665-30133-3-git-send-email-caoj.fnst@cn.fujitsu.com> Date: Wed, 02 Nov 2016 13:21:34 +0100 In-Reply-To: <1476859665-30133-3-git-send-email-caoj.fnst@cn.fujitsu.com> (Cao jin's message of "Wed, 19 Oct 2016 14:47:37 +0800") Message-ID: <87oa1yqdgx.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 02/10] hcd-xhci: check & correct param before using it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin Cc: qemu-devel@nongnu.org, Marcel Apfelbaum , "Michael S. Tsirkin" , Gerd Hoffmann Cao jin writes: > Param checking/correcting code of xchi->numintrs should be placed before > it is used. > Also move some resource-alloc code down, save the strenth to free them > on msi_init's failure. > > CC: Gerd Hoffmann > CC: Markus Armbruster > CC: Marcel Apfelbaum > CC: Michael S. Tsirkin > > Reviewed-by: Gerd Hoffmann > Signed-off-by: Cao jin Commit message could explain what's fixed in a bit more detail. Perhaps: hcd-xhci: check & correct param before using it usb_xhci_realize() corrects invalid values of property "intrs" automatically, but the uncorrected value is passed to msi_init(), which chokes on invalid values. Delay that until after the correction. Resources allocated by usb_xhci_init() are leaked when msi_init() fails. Fix by calling it after msi_init().