lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <396a52023e61a8f68e66dd9d37c44ea06fd731a4.1520455011.git.shuahkh@osg.samsung.com>
Date:   Wed,  7 Mar 2018 13:42:25 -0700
From:   Shuah Khan <shuahkh@....samsung.com>
To:     valentina.manea.m@...il.com, shuah@...nel.org,
        gregkh@...uxfoundation.org
Cc:     Shuah Khan <shuahkh@....samsung.com>, yuyang.du@...el.com,
        k.opasiak@...sung.com, nobuo.iwata@...ixerox.co.jp,
        julien.boibessot@...adeus.com, jdieter@...bg.com,
        peter.senna@...il.com, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] usbip: usbip_host_common: Use new error codes to return request status

Currently ST_OK and ST_NA are the only values used to communicate
status of a request from a client. Use new error codes to clearly
indicate what failed. For example, when client sends request to
import a device that isn't export-able, send ST_DEV_BUSY to the client.

Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
 tools/usb/usbip/libsrc/usbip_host_common.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/usb/usbip/libsrc/usbip_host_common.c b/tools/usb/usbip/libsrc/usbip_host_common.c
index 6ff7b601f854..dc93fadbee96 100644
--- a/tools/usb/usbip/libsrc/usbip_host_common.c
+++ b/tools/usb/usbip/libsrc/usbip_host_common.c
@@ -234,14 +234,17 @@ int usbip_export_device(struct usbip_exported_device *edev, int sockfd)
 		switch (edev->status) {
 		case SDEV_ST_ERROR:
 			dbg("status SDEV_ST_ERROR");
+			ret = ST_DEV_ERR;
 			break;
 		case SDEV_ST_USED:
 			dbg("status SDEV_ST_USED");
+			ret = ST_DEV_BUSY;
 			break;
 		default:
 			dbg("status unknown: 0x%x", edev->status);
+			ret = -1;
 		}
-		return -1;
+		return ret;
 	}
 
 	/* only the first interface is true */
-- 
2.14.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ