usbip-devel Mailing List for The USB/IP Project (Page 4)
Status: Alpha
Brought to you by:
hirofuchi
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2007 |
Jan
(9) |
Feb
|
Mar
(5) |
Apr
|
May
(3) |
Jun
(4) |
Jul
(8) |
Aug
(7) |
Sep
(6) |
Oct
|
Nov
(5) |
Dec
(10) |
2008 |
Jan
(2) |
Feb
(2) |
Mar
(1) |
Apr
(30) |
May
(26) |
Jun
(12) |
Jul
(26) |
Aug
(14) |
Sep
(20) |
Oct
(9) |
Nov
(19) |
Dec
(36) |
2009 |
Jan
(16) |
Feb
(18) |
Mar
(18) |
Apr
(24) |
May
(52) |
Jun
(69) |
Jul
(44) |
Aug
(12) |
Sep
(9) |
Oct
(1) |
Nov
(3) |
Dec
(4) |
2010 |
Jan
(12) |
Feb
(34) |
Mar
(6) |
Apr
(14) |
May
(9) |
Jun
(33) |
Jul
(18) |
Aug
(8) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
(8) |
2011 |
Jan
(11) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(69) |
Jun
(22) |
Jul
(11) |
Aug
(12) |
Sep
(13) |
Oct
(10) |
Nov
(2) |
Dec
(4) |
2012 |
Jan
(13) |
Feb
(5) |
Mar
(16) |
Apr
(21) |
May
(8) |
Jun
(10) |
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
(17) |
Nov
(4) |
Dec
(2) |
2013 |
Jan
|
Feb
(19) |
Mar
(5) |
Apr
(22) |
May
(4) |
Jun
(5) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
2014 |
Jan
(3) |
Feb
(8) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
(2) |
Oct
(5) |
Nov
(1) |
Dec
|
2015 |
Jan
(5) |
Feb
(1) |
Mar
(9) |
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
(2) |
Aug
(4) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:10
|
From: Stefan Reif <ke4...@ci...> This patch fixes the following checkpatch warning: -WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Stefan Reif <ke4...@ci...> Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/vhci_hcd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index f1ca084..d7974cb 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -956,11 +956,10 @@ static int vhci_bus_resume(struct usb_hcd *hcd) dev_dbg(&hcd->self.root_hub->dev, "%s\n", __func__); spin_lock(&vhci->lock); - if (!HCD_HW_ACCESSIBLE(hcd)) { + if (!HCD_HW_ACCESSIBLE(hcd)) rc = -ESHUTDOWN; - } else { + else hcd->state = HC_STATE_RUNNING; - } spin_unlock(&vhci->lock); return rc; -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:10
|
From: Stefan Reif <ke4...@ci...> This patch fixes the following checkpatch errors: -ERROR: space required after that ',' -ERROR: spaces required around that '=' -ERROR: space prohibited before that close parenthesis -WARNING: please, no space before tabs Signed-off-by: Stefan Reif <ke4...@ci...> Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/userspace/src/usbip_detach.c | 2 +- drivers/staging/usbip/userspace/src/usbip_network.c | 2 +- drivers/staging/usbip/userspace/src/usbip_network.h | 4 ++-- drivers/staging/usbip/userspace/src/usbipd.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/usbip/userspace/src/usbip_detach.c b/drivers/staging/usbip/userspace/src/usbip_detach.c index dac5f06..13308df 100644 --- a/drivers/staging/usbip/userspace/src/usbip_detach.c +++ b/drivers/staging/usbip/userspace/src/usbip_detach.c @@ -49,7 +49,7 @@ static int detach_port(char *port) uint8_t portnum; char path[PATH_MAX+1]; - for (unsigned int i=0; i < strlen(port); i++) + for (unsigned int i = 0; i < strlen(port); i++) if (!isdigit(port[i])) { err("invalid port %s", port); return -1; diff --git a/drivers/staging/usbip/userspace/src/usbip_network.c b/drivers/staging/usbip/userspace/src/usbip_network.c index 1a84dd3..4cb76e5 100644 --- a/drivers/staging/usbip/userspace/src/usbip_network.c +++ b/drivers/staging/usbip/userspace/src/usbip_network.c @@ -56,7 +56,7 @@ void usbip_net_pack_usb_device(int pack, struct usbip_usb_device *udev) { usbip_net_pack_uint32_t(pack, &udev->busnum); usbip_net_pack_uint32_t(pack, &udev->devnum); - usbip_net_pack_uint32_t(pack, &udev->speed ); + usbip_net_pack_uint32_t(pack, &udev->speed); usbip_net_pack_uint16_t(pack, &udev->idVendor); usbip_net_pack_uint16_t(pack, &udev->idProduct); diff --git a/drivers/staging/usbip/userspace/src/usbip_network.h b/drivers/staging/usbip/userspace/src/usbip_network.h index 2d1e070..1bbefc9 100644 --- a/drivers/staging/usbip/userspace/src/usbip_network.h +++ b/drivers/staging/usbip/userspace/src/usbip_network.h @@ -35,8 +35,8 @@ struct op_common { #define PACK_OP_COMMON(pack, op_common) do {\ usbip_net_pack_uint16_t(pack, &(op_common)->version);\ - usbip_net_pack_uint16_t(pack, &(op_common)->code );\ - usbip_net_pack_uint32_t(pack, &(op_common)->status );\ + usbip_net_pack_uint16_t(pack, &(op_common)->code);\ + usbip_net_pack_uint32_t(pack, &(op_common)->status);\ } while (0) /* ---------------------------------------------------------------------- */ diff --git a/drivers/staging/usbip/userspace/src/usbipd.c b/drivers/staging/usbip/userspace/src/usbipd.c index 34760cc..cc3be17 100644 --- a/drivers/staging/usbip/userspace/src/usbipd.c +++ b/drivers/staging/usbip/userspace/src/usbipd.c @@ -60,7 +60,7 @@ static const char usbipd_help_string[] = " -d, --debug \n" " Print debugging information. \n" " \n" - " -h, --help \n" + " -h, --help \n" " Print this help. \n" " \n" " -v, --version \n" @@ -446,7 +446,7 @@ static int do_standalone_mode(int daemonize) } if (daemonize) { - if (daemon(0,0) < 0) { + if (daemon(0, 0) < 0) { err("daemonizing failed: %s", strerror(errno)); return -1; } -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:10
|
This patch fixes the following checkpatch warning: -WARNING: missing space after enum definition Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/userspace/libsrc/usbip_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.h b/drivers/staging/usbip/userspace/libsrc/usbip_common.h index 0b2f370..938ad1c 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.h +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.h @@ -84,7 +84,7 @@ enum usb_device_speed { }; /* FIXME: how to sync with drivers/usbip_common.h ? */ -enum usbip_device_status{ +enum usbip_device_status { /* sdev is available. */ SDEV_ST_AVAILABLE = 0x01, /* sdev is now used. */ -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-11 20:26:36
|
On Mon, Feb 11, 2013 at 08:44:43AM +0800, Xiaofan Chen wrote: > On Mon, Feb 11, 2013 at 1:15 AM, Kurt Kanzenbach <ly8...@ci...> wrote: > > Hello, > > > > Stefan and I want to contribute to the USB/IP project. > > For a university project we aim to improve the USB/IP Linux driver and > > the corresponding user space tool. > > So far we want to know what are the major issues of that driver? > > From what I read, the Windows kernel driver needs much more > work than Linux. Want to take that challenge instead? I am sorry, but we are supposed to improve the Linux driver. This is why we will work on this one. > > -- > Xiaofan > regards, Kurt |
From: Xiaofan C. <xia...@gm...> - 2013-02-11 00:44:50
|
On Mon, Feb 11, 2013 at 1:15 AM, Kurt Kanzenbach <ly8...@ci...> wrote: > Hello, > > Stefan and I want to contribute to the USB/IP project. > For a university project we aim to improve the USB/IP Linux driver and > the corresponding user space tool. > So far we want to know what are the major issues of that driver? >From what I read, the Windows kernel driver needs much more work than Linux. Want to take that challenge instead? -- Xiaofan |
From: Kurt K. <ly8...@ci...> - 2013-02-10 17:16:01
|
Hello, Stefan and I want to contribute to the USB/IP project. For a university project we aim to improve the USB/IP Linux driver and the corresponding user space tool. So far we want to know what are the major issues of that driver? Thank you. best regards, Kurt Kanzenbach and Stefan Reif |
From: LEO <lee...@16...> - 2013-02-07 05:50:17
|
Ok now. 在2013-02-07,"LEO" <lee...@16...> 写道: -----原始邮件----- 发件人:"LEO" <lee...@16...> 发送时间:2013年02月7日 星期四 收件人:"usbip-devel" <usb...@li...> 主题:crosscompile usbip problem Hi, I followed the step showed on http://wiki.beyondlogic.org/index.php/Cross_Compiling_USBIP_for_ARM but when I cross compiling the usbip0.1.7 in /usbip-0.1.7/src/ , comes the error as below: checking for strtoul... yes checking sysfs/libsysfs.h usability... no checking sysfs/libsysfs.h presence... no checking for sysfs/libsysfs.h... no configure: error: Missing /usr/include/sysfs/libsysfs.h in my cross tools folder , I can find the libsysfs.h in toolschain/4.4.3/include/sysfs ,and I also copied one in the /usr/include/sysfs. Can you help me with this question? Thank you . Joney from China. |
From: LEO <lee...@16...> - 2013-02-07 05:32:52
|
Hi, I followed the step showed on http://wiki.beyondlogic.org/index.php/Cross_Compiling_USBIP_for_ARM but when I cross compiling the usbip0.1.7 in /usbip-0.1.7/src/ , comes the error as below: checking for strtoul... yes checking sysfs/libsysfs.h usability... no checking sysfs/libsysfs.h presence... no checking for sysfs/libsysfs.h... no configure: error: Missing /usr/include/sysfs/libsysfs.h in my cross tools folder , I can find the libsysfs.h in toolschain/4.4.3/include/sysfs ,and I also copied one in the /usr/include/sysfs. Can you help me with this question? Thank you . Joney from China. |
From: <pie...@tl...> - 2012-12-21 22:49:35
|
Hello, When can we expect a new version of the driver for windows? USBIP now does not work. Merry Christmas |
From: flooding C. <flo...@gm...> - 2012-11-30 10:15:45
|
is there someone still do this ? 2012/6/27 flooding Controlled <flo...@gm...> > sounds very good! > > > 2012/6/26 Gonzalo Araújo C <ga...@sl...> > >> Hello, i work in the past with a commercial product that have this >> functionability... >> >> Maybe we can do some research about how the driver work, >> >> Product: >> >> http://www.usb-over-network.com/usb-over-network.html >> http://www.fabulatech.com/usb-over-network.html >> >> Greetings. >> >> Gonzalo. >> >> 2012/6/26 sachindranath pv <lin...@gm...> >> >>> Hi , >>> >>> Now i am developing usbip server for windows . I dont know >>> the driver level socket transmission in windows.Can anybody help me. >>> >>> Thanks and Regards >>> sachi >>> >>> >>> ------------------------------------------------------------------------------ >>> Live Security Virtual Conference >>> Exclusive live event will cover all the ways today's security and >>> threat landscape has changed and how IT managers can respond. Discussions >>> will include endpoint security, mobile security and the latest in malware >>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>> _______________________________________________ >>> usbip-devel mailing list >>> usb...@li... >>> https://lists.sourceforge.net/lists/listinfo/usbip-devel >>> >>> >> >> >> -- >> Cordialmente: >> >> *Ing. Gonzalo Araujo C* >> MCSE, MCSA, MCSD, ITIL, IDF >> VTSP, VCP, CISSP, C|EH, LPI, HCDA >> >> *SLM Sistemas* >> ga...@sl... <des...@sl...> >> http://www.slmsistemas.com >> Colombia - Guatemala - Chile - Venezuela >> >> *Ingenio Virtual C.A* >> ga...@in... >> http://www.ingeniovirtual.com.ve >> *Tus Ideas, Nuestra Pasión!* >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> usbip-devel mailing list >> usb...@li... >> https://lists.sourceforge.net/lists/listinfo/usbip-devel >> >> > |
From: Ilija H. <ih...@re...> - 2012-11-29 23:47:38
|
File doc/usbip_bind_driver.8 does not exist but it is listed in dist_man_MANS. This breaks the build of the userspace. Remove the file from the list, until somebody submits the actual missing file. Signed-off-by: Ilija Hadzic <ih...@re...> --- drivers/staging/usbip/userspace/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/usbip/userspace/Makefile.am b/drivers/staging/usbip/userspace/Makefile.am index 9ab1949..66f8bf0 100644 --- a/drivers/staging/usbip/userspace/Makefile.am +++ b/drivers/staging/usbip/userspace/Makefile.am @@ -3,4 +3,4 @@ includedir = @includedir@/usbip include_HEADERS := $(addprefix libsrc/, \ usbip_common.h vhci_driver.h usbip_host_driver.h) -dist_man_MANS := $(addprefix doc/, usbip.8 usbipd.8 usbip_bind_driver.8) +dist_man_MANS := $(addprefix doc/, usbip.8 usbipd.8) -- 1.7.12 |
From: Linard V. <lin...@te...> - 2012-11-10 11:44:42
|
Maybe this bug report can help you: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/900384 On 11/09/2012 07:14 PM, Pedro Odin Mojica Ramirez wrote: > Hi all, > I have ubuntu 12.04 and install usbip, with run command usbip -p > displays the next posts: > > /sys/bus/platform/drivers/vhci_hcd is not found > load usbip_common_mod.ko and vhci-hcd.ko ! > > Has anyone had the same problem? No loads modules: vhci hcd.ko > usbip_common_mod.ko and load > > Cheers. |
From: Pedro O. M. R. <pm...@in...> - 2012-11-09 18:44:17
|
Hi all, I have ubuntu 12.04 and install usbip, with run command usbip -p displays the next posts: /sys/bus/platform/drivers/vhci_hcd is not found load usbip_common_mod.ko and vhci-hcd.ko ! Has anyone had the same problem? No loads modules: vhci hcd.ko usbip_common_mod.ko and load Cheers. -- |
From: Alessio M. <fug...@ho...> - 2012-10-30 17:12:21
|
Hello. I wish to know if there's the possibility to include kinect OpenNI driver in your project, in order to use the kinect in two different pc; up to now I managed to visualize the kinect, plugged to a Ubuntu 10.10, form a Windows XP using USB/IP 1.7 server and 1.0 client, but when I start the RGBDemo project from Nicolas Burrus I receive an error message like "can't send USB request control"; when I plug the kinect directly on XP the program works correctly. Could you help me? Thanks. |
From: Alessio M. <ale...@gm...> - 2012-10-30 17:10:55
|
Hello. I wish to know if there's the possibility to include kinect OpenNI driver in your project, in order to use the kinect in two different pc; up to now I managed to visualize the kinect, plugged to a Ubuntu 10.10, form a Windows XP using USB/IP 1.7 server and 1.0 client, but when I start the RGBDemo project from Nicolas Burrus I receive an error message like "can't send USB request control"; when I plug the kinect directly on XP the program works correctly. Could you help me? Thanks. Alessio |
From: Alexander T. <ale...@es...> - 2012-10-30 10:31:53
|
On Mon, Oct 29, 2012 at 6:28 PM, Matthias Bock <ma...@ma...>wrote: > On 10/29/2012 05:17 PM, Fernando Cassia wrote: > > So what I´d like to know is if there´s a USBIP feature where a PC with > > a USB controller which can be put into client mode, can fake being a > > "Client mode", that would require a USB OTG port, right? > Not sure, if regular PC USB ports can be put > into something like a "client mode". > I don't think so, OTG requires support on the hardware level. A tiny solution that offers a USB OTG port is a Gumstix Overo with for instance a Summit or Tobi expansion board. Then again, I don't see a role for USBIP here. Everything would happen on the computer, no network is involved. > "USB MASS STORAGE" device and make files from its filesystem appear as > > contents on a usb mass storage device... > > > > Think that´d be possible, if not possible already?. > > Haven't done it yet, should be easily possible though. > Just mount the DVD drive on the regular USB port > and share the mounted directory via the USB OTG port. > What I find strange is that a USB CD/DVD drive should behave as any USB mass storage device and should not require special drivers. For the media player it shouldn't matter what kind of device it really is. Maybe the reason why it does not work is that the media player does not support the ISO9660 or UDF file systems (those are only rarely used on USB pen drives). You could try formatting a USB pen drive with one of those file systems to verify this. If that does not work, then disguising the CD/DVD drive as a USB pen drive will not solve the problem. Doesn't the media player support mounting network shares? If so, it may be possible to share the optical drive on the PC and make it available on the network. Or, if the media player runs some flavor of Linux, it might be possible to upgrade the kernel to support whatever feature is currently missing (CD/DVD drive, filesystems?) Alexander |
From: Matthias B. <ma...@ma...> - 2012-10-29 18:03:14
|
On 10/29/2012 05:17 PM, Fernando Cassia wrote: > But how can USB-IP help if what I want to do is plug a USB optical > device (CD/DVD reader with ISO9660 or UDF filesystem) and make the > contents accesible as a USB "pen drive" (usb mass storage) device?. Don't know, probably usbip is not what you need. > So what I´d like to know is if there´s a USBIP feature where a PC with > a USB controller which can be put into client mode, can fake being a "Client mode", that would require a USB OTG port, right? Not sure, if regular PC USB ports can be put into something like a "client mode". > "USB MASS STORAGE" device and make files from its filesystem appear as > contents on a usb mass storage device... > > Think that´d be possible, if not possible already?. Haven't done it yet, should be easily possible though. Just mount the DVD drive on the regular USB port and share the mounted directory via the USB OTG port. As device you could use e.g. the Miniand Xplus https://www.miniand.com/products/Mini%C2%A0Xplus%20TV%20Box%20H24 Cheers, Matthias |
From: Fernando C. <fc...@gm...> - 2012-10-29 16:18:00
|
Hi, I´m sure that from a technical POV a USB mass storage device is, well, a USB mass storage device. Then it´s up to the OS to determine what kind of device it is. But how can USB-IP help if what I want to do is plug a USB optical device (CD/DVD reader with ISO9660 or UDF filesystem) and make the contents accesible as a USB "pen drive" (usb mass storage) device?. The reason to ask this is that I have a device (media player attached to a TV) that happily accepts "pen drives" and external hard drives, but does NOT accept a USB CD/DVD reader... and I happen to have most of my movies burned to DVD-R already. So what I´d like to know is if there´s a USBIP feature where a PC with a USB controller which can be put into client mode, can fake being a "USB MASS STORAGE" device and make files from its filesystem appear as contents on a usb mass storage device... Think that´d be possible, if not possible already?. FC PS: Sorry to post this on the dev list. I tried looking if there was a "USBIP-users" list but it seems there´s none. (And I really really hate web based forums ;). -- During times of Universal Deceit, telling the truth becomes a revolutionary act Durante épocas de Engaño Universal, decir la verdad se convierte en un Acto Revolucionario - George Orwell |
From: Bernard B. <be...@la...> - 2012-10-22 21:57:48
|
On 22/10/2012, at 9:39 PM, Greg KH <gr...@kr...> wrote: > On Mon, Oct 22, 2012 at 06:45:36AM +1100, Bernard Blackham wrote: >> This patch cleans up much of the locking in usbip, as well as fixing >> some logic errors. In particular: >> >> - some spinlocks were taken with interrupts disabled in some >> places, but not always. >> >> - many error paths duplicated unwinding code; these have been >> changed to use conventional goto idioms for unwinding on error. >> >> - usb_hcd_giveback_urb was called incorrectly when vhci_urb_enqueue >> returned an error. >> >> - vhci_device_unlink_cleanup did not properly clean up URBs which >> had not yet been transmitted yet. > > That's a lot to do all in one patch, making it hard to review. Can you > split this up into smaller pieces, one patch per thing you do above, so > we can apply it? No problem. I'll try to split these up and redo them against usb-next. Cheers, Bernard. |
From: Greg KH <gr...@kr...> - 2012-10-22 20:40:38
|
On Mon, Oct 22, 2012 at 06:44:41AM +1100, Bernard Blackham wrote: > This patch set fixes a number of crashes, deadlocks and resource > leaks in usbip. It also makes some changes to improve style and > consistency. I've applied 2 of these, care to redo the rest against my latest usb-next tree and resend them? thanks, greg k-h |
From: Greg KH <gr...@kr...> - 2012-10-22 20:40:00
|
On Mon, Oct 22, 2012 at 06:45:36AM +1100, Bernard Blackham wrote: > This patch cleans up much of the locking in usbip, as well as fixing > some logic errors. In particular: > > - some spinlocks were taken with interrupts disabled in some > places, but not always. > > - many error paths duplicated unwinding code; these have been > changed to use conventional goto idioms for unwinding on error. > > - usb_hcd_giveback_urb was called incorrectly when vhci_urb_enqueue > returned an error. > > - vhci_device_unlink_cleanup did not properly clean up URBs which > had not yet been transmitted yet. That's a lot to do all in one patch, making it hard to review. Can you split this up into smaller pieces, one patch per thing you do above, so we can apply it? thanks, greg k-h |
From: Bernard B. <b-l...@la...> - 2012-10-21 20:02:33
|
This patch cleans up much of the locking in usbip, as well as fixing some logic errors. In particular: - some spinlocks were taken with interrupts disabled in some places, but not always. - many error paths duplicated unwinding code; these have been changed to use conventional goto idioms for unwinding on error. - usb_hcd_giveback_urb was called incorrectly when vhci_urb_enqueue returned an error. - vhci_device_unlink_cleanup did not properly clean up URBs which had not yet been transmitted yet. Signed-off-by: Bernard Blackham <b-l...@la...> --- drivers/staging/usbip/vhci_hcd.c | 147 ++++++++++++++++++------------------ drivers/staging/usbip/vhci_rx.c | 34 ++++----- drivers/staging/usbip/vhci_sysfs.c | 31 ++++---- 3 files changed, 104 insertions(+), 108 deletions(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index b51e4ee..bb54fc5 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -453,7 +453,7 @@ static void vhci_tx_urb(struct urb *urb) { struct vhci_device *vdev = get_vdev(urb->dev); struct vhci_priv *priv; - unsigned long flag; + unsigned long flags; if (!vdev) { pr_err("could not get virtual device"); @@ -463,11 +463,8 @@ static void vhci_tx_urb(struct urb *urb) priv = kzalloc(sizeof(struct vhci_priv), GFP_ATOMIC); - spin_lock_irqsave(&vdev->priv_lock, flag); - if (!priv) { dev_err(&urb->dev->dev, "malloc vhci_priv\n"); - spin_unlock_irqrestore(&vdev->priv_lock, flag); usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC); return; } @@ -481,10 +478,12 @@ static void vhci_tx_urb(struct urb *urb) urb->hcpriv = (void *) priv; + spin_lock_irqsave(&vdev->priv_lock, flags); + list_add_tail(&priv->list, &vdev->priv_tx); wake_up(&vdev->waitq_tx); - spin_unlock_irqrestore(&vdev->priv_lock, flag); + spin_unlock_irqrestore(&vdev->priv_lock, flags); } static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, @@ -505,8 +504,8 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, if (urb->status != -EINPROGRESS) { dev_err(dev, "URB already unlinked!, status %d\n", urb->status); - spin_unlock_irqrestore(&the_controller->lock, flags); - return urb->status; + ret = urb->status; + goto no_need_unlink; } vdev = port_to_vdev(urb->dev->portnum-1); @@ -517,8 +516,8 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, vdev->ud.status == VDEV_ST_ERROR) { dev_err(dev, "enqueue for inactive port %d\n", vdev->rhport); spin_unlock(&vdev->ud.lock); - spin_unlock_irqrestore(&the_controller->lock, flags); - return -ENODEV; + ret = -ENODEV; + goto no_need_unlink; } spin_unlock(&vdev->ud.lock); @@ -600,7 +599,9 @@ no_need_xmit: usb_hcd_unlink_urb_from_ep(hcd, urb); no_need_unlink: spin_unlock_irqrestore(&the_controller->lock, flags); - usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); + if (ret == 0) + usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, + urb->status); return ret; } @@ -655,43 +656,38 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) unsigned long flags; struct vhci_priv *priv; struct vhci_device *vdev; + int ret = 0; + int giveback = 0; pr_info("dequeue a urb %p\n", urb); - spin_lock_irqsave(&the_controller->lock, flags); - priv = urb->hcpriv; if (!priv) { - /* URB was never linked! or will be soon given back by - * vhci_rx. */ - spin_unlock_irqrestore(&the_controller->lock, flags); - return 0; - } - - { - int ret = 0; - ret = usb_hcd_check_unlink_urb(hcd, urb, status); - if (ret) { - spin_unlock_irqrestore(&the_controller->lock, flags); - return ret; - } + /* URB was never linked! + * or will be soon given back by vhci_rx. */ + goto out; } /* send unlink request here? */ vdev = priv->vdev; + spin_lock_irqsave(&the_controller->lock, flags); + + ret = usb_hcd_check_unlink_urb(hcd, urb, status); + if (ret) { + goto out_unlock; + } + if (!vdev->ud.tcp_socket) { /* tcp connection is closed */ - unsigned long flags2; - - spin_lock_irqsave(&vdev->priv_lock, flags2); pr_info("device %p seems to be disconnected\n", vdev); + spin_lock(&vdev->priv_lock); list_del(&priv->list); - kfree(priv); - urb->hcpriv = NULL; + spin_unlock(&vdev->priv_lock); - spin_unlock_irqrestore(&vdev->priv_lock, flags2); + urb->hcpriv = NULL; + kfree(priv); /* * If tcp connection is alive, we have sent CMD_UNLINK. @@ -702,26 +698,18 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) usb_hcd_unlink_urb_from_ep(hcd, urb); - spin_unlock_irqrestore(&the_controller->lock, flags); - usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, - urb->status); - spin_lock_irqsave(&the_controller->lock, flags); - + /* Give back the URB outside of the lock. */ + giveback = 1; } else { /* tcp connection is alive */ - unsigned long flags2; struct vhci_unlink *unlink; - spin_lock_irqsave(&vdev->priv_lock, flags2); - /* setup CMD_UNLINK pdu */ unlink = kzalloc(sizeof(struct vhci_unlink), GFP_ATOMIC); if (!unlink) { pr_err("malloc vhci_unlink\n"); - spin_unlock_irqrestore(&vdev->priv_lock, flags2); - spin_unlock_irqrestore(&the_controller->lock, flags); - usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC); - return -ENOMEM; + ret = -ENOMEM; + goto out_unlock; } unlink->seqnum = atomic_inc_return(&the_controller->seqnum); @@ -732,71 +720,77 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) pr_info("device %p seems to be still connected\n", vdev); + spin_lock(&vdev->priv_lock); + /* send cmd_unlink and try to cancel the pending URB in the * peer */ list_add_tail(&unlink->list, &vdev->unlink_tx); wake_up(&vdev->waitq_tx); - spin_unlock_irqrestore(&vdev->priv_lock, flags2); + spin_unlock(&vdev->priv_lock); } +out_unlock: spin_unlock_irqrestore(&the_controller->lock, flags); + if (giveback) + usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, + urb->status); + + if (ret == -ENOMEM) + usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC); + +out: usbip_dbg_vhci_hc("leave\n"); - return 0; + return ret; } static void vhci_device_unlink_cleanup(struct vhci_device *vdev) { - struct vhci_unlink *unlink, *tmp; - - spin_lock(&the_controller->lock); - spin_lock(&vdev->priv_lock); - - list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { - pr_info("unlink cleanup tx %lu\n", unlink->unlink_seqnum); - list_del(&unlink->list); - kfree(unlink); - } + struct vhci_unlink *unlink; + unsigned long flags; - while (!list_empty(&vdev->unlink_rx)) { + spin_lock_irqsave(&vdev->priv_lock, flags); + while (!list_empty(&vdev->unlink_tx) || !list_empty(&vdev->unlink_rx)) { struct urb *urb; - unlink = list_first_entry(&vdev->unlink_rx, struct vhci_unlink, - list); + if (list_empty(&vdev->unlink_tx)) { + unlink = list_first_entry(&vdev->unlink_rx, + struct vhci_unlink, list); + } else { + unlink = list_first_entry(&vdev->unlink_tx, + struct vhci_unlink, list); + } /* give back URB of unanswered unlink request */ pr_info("unlink cleanup rx %lu\n", unlink->unlink_seqnum); + list_del(&unlink->list); urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); if (!urb) { pr_info("the urb (seqnum %lu) was already given back\n", unlink->unlink_seqnum); - list_del(&unlink->list); kfree(unlink); continue; } urb->status = -ENODEV; - usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); - - list_del(&unlink->list); + spin_unlock_irqrestore(&vdev->priv_lock, flags); - spin_unlock(&vdev->priv_lock); - spin_unlock(&the_controller->lock); + spin_lock_irqsave(&the_controller->lock, flags); + usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); + spin_unlock_irqrestore(&the_controller->lock, flags); usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); - spin_lock(&the_controller->lock); - spin_lock(&vdev->priv_lock); - kfree(unlink); + + spin_lock_irqsave(&vdev->priv_lock, flags); } - spin_unlock(&vdev->priv_lock); - spin_unlock(&the_controller->lock); + spin_unlock_irqrestore(&vdev->priv_lock, flags); } /* @@ -860,8 +854,9 @@ static void vhci_shutdown_connection(struct usbip_device *ud) static void vhci_device_reset(struct usbip_device *ud) { struct vhci_device *vdev = container_of(ud, struct vhci_device, ud); + unsigned long flags; - spin_lock(&ud->lock); + spin_lock_irqsave(&ud->lock, flags); vdev->speed = 0; vdev->devid = 0; @@ -876,14 +871,15 @@ static void vhci_device_reset(struct usbip_device *ud) } ud->status = VDEV_ST_NULL; - spin_unlock(&ud->lock); + spin_unlock_irqrestore(&ud->lock, flags); } static void vhci_device_unusable(struct usbip_device *ud) { - spin_lock(&ud->lock); + unsigned long flags; + spin_lock_irqsave(&ud->lock, flags); ud->status = VDEV_ST_ERROR; - spin_unlock(&ud->lock); + spin_unlock_irqrestore(&ud->lock, flags); } static void vhci_device_init(struct vhci_device *vdev) @@ -1105,17 +1101,18 @@ static int vhci_hcd_suspend(struct platform_device *pdev, pm_message_t state) int rhport = 0; int connected = 0; int ret = 0; + unsigned long flags; hcd = platform_get_drvdata(pdev); - spin_lock(&the_controller->lock); + spin_lock_irqsave(&the_controller->lock, flags); for (rhport = 0; rhport < VHCI_NPORTS; rhport++) if (the_controller->port_status[rhport] & USB_PORT_STAT_CONNECTION) connected += 1; - spin_unlock(&the_controller->lock); + spin_unlock_irqrestore(&the_controller->lock, flags); if (connected > 0) { dev_info(&pdev->dev, "We have %d active connection%s. Do not " diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c index f0eaf04..ec91306 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/staging/usbip/vhci_rx.c @@ -68,11 +68,10 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, { struct usbip_device *ud = &vdev->ud; struct urb *urb; - unsigned long flags; - spin_lock(&vdev->priv_lock); + spin_lock_irq(&vdev->priv_lock); urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); - spin_unlock(&vdev->priv_lock); + spin_unlock_irq(&vdev->priv_lock); if (!urb) { pr_err("cannot find a urb of seqnum %u\n", pdu->base.seqnum); @@ -101,9 +100,9 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, usbip_dbg_vhci_rx("now giveback urb %p\n", urb); - spin_lock_irqsave(&the_controller->lock, flags); + spin_lock_irq(&the_controller->lock); usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); - spin_unlock_irqrestore(&the_controller->lock, flags); + spin_unlock_irq(&the_controller->lock); usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); @@ -115,9 +114,10 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev, struct usbip_header *pdu) { - struct vhci_unlink *unlink, *tmp; + struct vhci_unlink *unlink = NULL; + struct vhci_unlink *tmp; - spin_lock(&vdev->priv_lock); + spin_lock_irq(&vdev->priv_lock); list_for_each_entry_safe(unlink, tmp, &vdev->unlink_rx, list) { pr_info("unlink->seqnum %lu\n", unlink->seqnum); @@ -126,14 +126,13 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev, unlink->seqnum); list_del(&unlink->list); - spin_unlock(&vdev->priv_lock); - return unlink; + break; } } - spin_unlock(&vdev->priv_lock); + spin_unlock_irq(&vdev->priv_lock); - return NULL; + return unlink; } static void vhci_recv_ret_unlink(struct vhci_device *vdev, @@ -141,7 +140,6 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, { struct vhci_unlink *unlink; struct urb *urb; - unsigned long flags; usbip_dump_header(pdu); @@ -152,9 +150,9 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, return; } - spin_lock(&vdev->priv_lock); + spin_lock_irq(&vdev->priv_lock); urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); - spin_unlock(&vdev->priv_lock); + spin_unlock_irq(&vdev->priv_lock); if (!urb) { /* @@ -171,9 +169,9 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, urb->status = pdu->u.ret_unlink.status; pr_info("urb->status %d\n", urb->status); - spin_lock_irqsave(&the_controller->lock, flags); + spin_lock_irq(&the_controller->lock); usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); - spin_unlock_irqrestore(&the_controller->lock, flags); + spin_unlock_irq(&the_controller->lock); usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); @@ -186,9 +184,9 @@ static int vhci_priv_tx_empty(struct vhci_device *vdev) { int empty = 0; - spin_lock(&vdev->priv_lock); + spin_lock_irq(&vdev->priv_lock); empty = list_empty(&vdev->priv_rx); - spin_unlock(&vdev->priv_lock); + spin_unlock_irq(&vdev->priv_lock); return empty; } diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c index c66e9c0..f992512 100644 --- a/drivers/staging/usbip/vhci_sysfs.c +++ b/drivers/staging/usbip/vhci_sysfs.c @@ -32,10 +32,11 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr, { char *s = out; int i = 0; + unsigned long flags; BUG_ON(!the_controller || !out); - spin_lock(&the_controller->lock); + spin_lock_irqsave(&the_controller->lock, flags); /* * output example: @@ -70,7 +71,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr, spin_unlock(&vdev->ud.lock); } - spin_unlock(&the_controller->lock); + spin_unlock_irqrestore(&the_controller->lock, flags); return out - s; } @@ -80,32 +81,31 @@ static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); static int vhci_port_disconnect(__u32 rhport) { struct vhci_device *vdev; + unsigned long flags; + int ret = 0; usbip_dbg_vhci_sysfs("enter\n"); /* lock */ - spin_lock(&the_controller->lock); + spin_lock_irqsave(&the_controller->lock, flags); vdev = port_to_vdev(rhport); spin_lock(&vdev->ud.lock); + if (vdev->ud.status == VDEV_ST_NULL) { pr_err("not connected %d\n", vdev->ud.status); - - /* unlock */ - spin_unlock(&vdev->ud.lock); - spin_unlock(&the_controller->lock); - - return -EINVAL; + ret = -EINVAL; } /* unlock */ spin_unlock(&vdev->ud.lock); - spin_unlock(&the_controller->lock); + spin_unlock_irqrestore(&the_controller->lock, flags); - usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN); + if (ret == 0) + usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN); - return 0; + return ret; } static ssize_t store_detach(struct device *dev, struct device_attribute *attr, @@ -170,6 +170,7 @@ static int valid_args(__u32 rhport, enum usb_device_speed speed) static ssize_t store_attach(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + unsigned long flags; struct vhci_device *vdev; struct socket *socket; int sockfd = 0; @@ -199,14 +200,14 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, /* now need lock until setting vdev status as used */ /* begin a lock */ - spin_lock(&the_controller->lock); + spin_lock_irqsave(&the_controller->lock, flags); vdev = port_to_vdev(rhport); spin_lock(&vdev->ud.lock); if (vdev->ud.status != VDEV_ST_NULL) { /* end of the lock */ spin_unlock(&vdev->ud.lock); - spin_unlock(&the_controller->lock); + spin_unlock_irqrestore(&the_controller->lock, flags); fput(socket->file); @@ -223,7 +224,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, vdev->ud.status = VDEV_ST_NOTASSIGNED; spin_unlock(&vdev->ud.lock); - spin_unlock(&the_controller->lock); + spin_unlock_irqrestore(&the_controller->lock, flags); /* end the lock */ vdev->ud.tcp_rx = kthread_get_run(vhci_rx_loop, &vdev->ud, "vhci_rx"); -- 1.7.10.4 |
From: Bernard B. <b-l...@la...> - 2012-10-21 20:02:32
|
Clean up some debug messages and comments. Signed-off-by: Bernard Blackham <b-l...@la...> --- drivers/staging/usbip/usbip_event.c | 2 +- drivers/staging/usbip/vhci_hcd.c | 23 ++++++++++------------- drivers/staging/usbip/vhci_rx.c | 12 ++++++------ 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c index d332a34..be94143 100644 --- a/drivers/staging/usbip/usbip_event.c +++ b/drivers/staging/usbip/usbip_event.c @@ -53,7 +53,7 @@ static int event_handler(struct usbip_device *ud) ud->event &= ~USBIP_EH_UNUSABLE; } - /* Stop the error handler. */ + /* Stop the event handler. */ if (ud->event & USBIP_EH_BYE) return -1; } diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index bb54fc5..6568f1f 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -219,8 +219,6 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf) } } - pr_info("changed %d\n", changed); - if (hcd->state == HC_STATE_SUSPENDED) usb_hcd_resume_root_hub(hcd); @@ -659,7 +657,7 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) int ret = 0; int giveback = 0; - pr_info("dequeue a urb %p\n", urb); + pr_debug("dequeue a urb %p\n", urb); priv = urb->hcpriv; if (!priv) { @@ -680,8 +678,8 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) if (!vdev->ud.tcp_socket) { /* tcp connection is closed */ + pr_debug("device %p seems to be disconnected\n", vdev); - pr_info("device %p seems to be disconnected\n", vdev); spin_lock(&vdev->priv_lock); list_del(&priv->list); spin_unlock(&vdev->priv_lock); @@ -694,7 +692,7 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) * vhci_rx will receive RET_UNLINK and give back the URB. * Otherwise, we give back it here. */ - pr_info("gives back urb %p\n", urb); + pr_debug("gives back urb %p\n", urb); usb_hcd_unlink_urb_from_ep(hcd, urb); @@ -714,11 +712,11 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) unlink->seqnum = atomic_inc_return(&the_controller->seqnum); if (unlink->seqnum == 0xffff) - pr_info("seqnum max\n"); + pr_debug("seqnum max\n"); - unlink->unlink_seqnum = priv->seqnum; + pr_debug("device %p seems to be still connected\n", vdev); - pr_info("device %p seems to be still connected\n", vdev); + unlink->unlink_seqnum = priv->seqnum; spin_lock(&vdev->priv_lock); @@ -763,12 +761,11 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) } /* give back URB of unanswered unlink request */ - pr_info("unlink cleanup rx %lu\n", unlink->unlink_seqnum); list_del(&unlink->list); urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); if (!urb) { - pr_info("the urb (seqnum %lu) was already given back\n", + pr_debug("the urb (seqnum %lu) was already given back\n", unlink->unlink_seqnum); kfree(unlink); continue; @@ -814,14 +811,14 @@ static void vhci_shutdown_connection(struct usbip_device *ud) if (vdev->ud.tcp_tx) kthread_stop_put(vdev->ud.tcp_tx); - pr_info("stop threads\n"); + pr_debug("stop threads\n"); /* active connection is closed */ if (vdev->ud.tcp_socket) { fput(vdev->ud.tcp_socket->file); vdev->ud.tcp_socket = NULL; } - pr_info("release socket\n"); + pr_debug("release socket\n"); vhci_device_unlink_cleanup(vdev); @@ -847,7 +844,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud) */ rh_port_disconnect(vdev->rhport); - pr_info("disconnect device\n"); + pr_debug("disconnect device\n"); } diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c index ec91306..85f7580 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/staging/usbip/vhci_rx.c @@ -75,7 +75,7 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, if (!urb) { pr_err("cannot find a urb of seqnum %u\n", pdu->base.seqnum); - pr_info("max seqnum %d\n", + pr_debug("max seqnum %d\n", atomic_read(&the_controller->seqnum)); usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); return; @@ -86,11 +86,11 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, /* recv transfer buffer */ if (usbip_recv_xbuff(ud, urb) < 0) - return; + return; /* XXX: unlink/giveback? */ /* recv iso_packet_descriptor */ if (usbip_recv_iso(ud, urb) < 0) - return; + return; /* XXX: unlink/giveback? */ /* restore the padding in iso packets */ usbip_pad_iso(ud, urb); @@ -120,7 +120,7 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev, spin_lock_irq(&vdev->priv_lock); list_for_each_entry_safe(unlink, tmp, &vdev->unlink_rx, list) { - pr_info("unlink->seqnum %lu\n", unlink->seqnum); + pr_debug("unlink->seqnum %lu\n", unlink->seqnum); if (unlink->seqnum == pdu->base.seqnum) { usbip_dbg_vhci_rx("found pending unlink, %lu\n", unlink->seqnum); @@ -160,14 +160,14 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, * already received the result of its submit result and gave * back the URB. */ - pr_info("the urb (seqnum %d) was already given back\n", + pr_debug("the urb (seqnum %d) was already given back\n", pdu->base.seqnum); } else { usbip_dbg_vhci_rx("now giveback urb %p\n", urb); /* If unlink is succeed, status is -ECONNRESET */ urb->status = pdu->u.ret_unlink.status; - pr_info("urb->status %d\n", urb->status); + pr_debug("urb->status %d\n", urb->status); spin_lock_irq(&the_controller->lock); usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); -- 1.7.10.4 |
From: Bernard B. <be...@la...> - 2012-10-21 20:02:27
|
usbip takes a reference on a struct file which is passed in via sysfs. Previously, this reference was never cleaned up, although the socket it referred to was. This patch drops the corresponding reference (found with the socket's ->file backpointer) instead of just closing the socket. Signed-off-by: Bernard Blackham <b-l...@la...> --- drivers/staging/usbip/stub_dev.c | 3 ++- drivers/staging/usbip/usbip_common.c | 4 +++- drivers/staging/usbip/vhci_hcd.c | 10 +++++++--- drivers/staging/usbip/vhci_sysfs.c | 6 +++++- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index 92ced35..bed4900 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -18,6 +18,7 @@ */ #include <linux/device.h> +#include <linux/file.h> #include <linux/kthread.h> #include <linux/module.h> @@ -199,7 +200,7 @@ static void stub_shutdown_connection(struct usbip_device *ud) * not touch NULL socket. */ if (ud->tcp_socket) { - sock_release(ud->tcp_socket); + fput(ud->tcp_socket->file); ud->tcp_socket = NULL; } diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index 70f23026..469a4ef 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c @@ -410,8 +410,10 @@ struct socket *sockfd_to_socket(unsigned int sockfd) inode = file->f_dentry->d_inode; - if (!inode || !S_ISSOCK(inode->i_mode)) + if (!inode || !S_ISSOCK(inode->i_mode)) { + fput(file); return NULL; + } socket = SOCKET_I(inode); diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index dfeb492..2e33ded 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -18,6 +18,7 @@ */ #include <linux/init.h> +#include <linux/file.h> #include <linux/kernel.h> #include <linux/kthread.h> #include <linux/module.h> @@ -822,8 +823,8 @@ static void vhci_shutdown_connection(struct usbip_device *ud) pr_info("stop threads\n"); /* active connection is closed */ - if (vdev->ud.tcp_socket != NULL) { - sock_release(vdev->ud.tcp_socket); + if (vdev->ud.tcp_socket) { + fput(vdev->ud.tcp_socket->file); vdev->ud.tcp_socket = NULL; } pr_info("release socket\n"); @@ -869,7 +870,10 @@ static void vhci_device_reset(struct usbip_device *ud) usb_put_dev(vdev->udev); vdev->udev = NULL; - ud->tcp_socket = NULL; + if (ud->tcp_socket) { + fput(ud->tcp_socket->file); + ud->tcp_socket = NULL; + } ud->status = VDEV_ST_NULL; spin_unlock(&ud->lock); diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c index 7ce9c2f..c66e9c0 100644 --- a/drivers/staging/usbip/vhci_sysfs.c +++ b/drivers/staging/usbip/vhci_sysfs.c @@ -18,6 +18,7 @@ */ #include <linux/kthread.h> +#include <linux/file.h> #include <linux/net.h> #include "usbip_common.h" @@ -189,7 +190,8 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, if (valid_args(rhport, speed) < 0) return -EINVAL; - /* check sockfd */ + /* Extract socket from fd. */ + /* The correct way to clean this up is to fput(socket->file). */ socket = sockfd_to_socket(sockfd); if (!socket) return -EINVAL; @@ -206,6 +208,8 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, spin_unlock(&vdev->ud.lock); spin_unlock(&the_controller->lock); + fput(socket->file); + dev_err(dev, "port %d already used\n", rhport); return -EINVAL; } -- 1.7.10.4 |
From: Bernard B. <b-l...@la...> - 2012-10-21 20:02:26
|
We don't need to iterate over a list just to pull off the head. Signed-off-by: Bernard Blackham <b-l...@la...> --- drivers/staging/usbip/vhci_tx.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/usbip/vhci_tx.c b/drivers/staging/usbip/vhci_tx.c index 9b437e7..89c8cb2 100644 --- a/drivers/staging/usbip/vhci_tx.c +++ b/drivers/staging/usbip/vhci_tx.c @@ -47,19 +47,18 @@ static void setup_cmd_submit_pdu(struct usbip_header *pdup, struct urb *urb) static struct vhci_priv *dequeue_from_priv_tx(struct vhci_device *vdev) { unsigned long flags; - struct vhci_priv *priv, *tmp; + struct vhci_priv *priv = NULL; spin_lock_irqsave(&vdev->priv_lock, flags); - list_for_each_entry_safe(priv, tmp, &vdev->priv_tx, list) { + if (!list_empty(&vdev->priv_tx)) { + priv = list_first_entry(&vdev->priv_tx, struct vhci_priv, list); list_move_tail(&priv->list, &vdev->priv_rx); - spin_unlock_irqrestore(&vdev->priv_lock, flags); - return priv; } spin_unlock_irqrestore(&vdev->priv_lock, flags); - return NULL; + return priv; } static int vhci_send_cmd_submit(struct vhci_device *vdev) @@ -137,19 +136,19 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev) static struct vhci_unlink *dequeue_from_unlink_tx(struct vhci_device *vdev) { unsigned long flags; - struct vhci_unlink *unlink, *tmp; + struct vhci_unlink *unlink = NULL; spin_lock_irqsave(&vdev->priv_lock, flags); - list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { + if (!list_empty(&vdev->unlink_tx)) { + unlink = list_first_entry(&vdev->unlink_tx, struct vhci_unlink, + list); list_move_tail(&unlink->list, &vdev->unlink_rx); - spin_unlock_irqrestore(&vdev->priv_lock, flags); - return unlink; } spin_unlock_irqrestore(&vdev->priv_lock, flags); - return NULL; + return unlink; } static int vhci_send_cmd_unlink(struct vhci_device *vdev) -- 1.7.10.4 |