From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRmTz-0005vl-W5 for qemu-devel@nongnu.org; Wed, 01 Jun 2011 10:33:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRmTy-0001QN-NW for qemu-devel@nongnu.org; Wed, 01 Jun 2011 10:33:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRmTy-0001QG-B6 for qemu-devel@nongnu.org; Wed, 01 Jun 2011 10:33:14 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p51EXD4d031617 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 1 Jun 2011 10:33:13 -0400 Message-ID: <4DE64DB8.20008@redhat.com> Date: Wed, 01 Jun 2011 16:33:28 +0200 From: Hans de Goede MIME-Version: 1.0 References: <1306834530-12763-1-git-send-email-hdegoede@redhat.com> <1306834530-12763-6-git-send-email-hdegoede@redhat.com> <4DE62F01.9000206@redhat.com> In-Reply-To: <4DE62F01.9000206@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/14] usb-linux: Don't call usb_host_close when usb_host_open fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Hi, On 06/01/2011 02:22 PM, Gerd Hoffmann wrote: > > What bug you are trying to fix here? Nothing in particular, while looking at some other stuff I noticed that we have the following sequence, which is wrong: usb_host_open called usb_host_open calls usb_host_claim_interfaces usb_host_claim_interfaces calls do_disconnect because of failure do_disconnect calls usb_host_close usb_host_close iterates over endpoints, but usb_linux_update_endp_table has not been called to initialize the endpoints at this points usb_host_close calls usb_device_detach, but not attached yet usb_host_close does an not needed ioctl(dev->fd, USBDEVFS_RESET); usb_host_closes the fd usb_host_open jumps to fail, closes the fd *again* All of this is does not lead to any real user visible bugs, but from a code flow pov it is wrong. Regards, Hans