|
@@ -86,7 +86,6 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
|
|
|
struct stub_device *sdev = dev_get_drvdata(dev);
|
|
struct stub_device *sdev = dev_get_drvdata(dev);
|
|
|
int sockfd = 0;
|
|
int sockfd = 0;
|
|
|
struct socket *socket;
|
|
struct socket *socket;
|
|
|
- ssize_t err = -EINVAL;
|
|
|
|
|
|
|
|
|
|
if (!sdev) {
|
|
if (!sdev) {
|
|
|
dev_err(dev, "sdev is null\n");
|
|
dev_err(dev, "sdev is null\n");
|
|
@@ -96,6 +95,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
|
|
|
sscanf(buf, "%d", &sockfd);
|
|
sscanf(buf, "%d", &sockfd);
|
|
|
|
|
|
|
|
if (sockfd != -1) {
|
|
if (sockfd != -1) {
|
|
|
|
|
+ int err;
|
|
|
dev_info(dev, "stub up\n");
|
|
dev_info(dev, "stub up\n");
|
|
|
|
|
|
|
|
spin_lock_irq(&sdev->ud.lock);
|
|
spin_lock_irq(&sdev->ud.lock);
|
|
@@ -105,7 +105,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
|
|
|
goto err;
|
|
goto err;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- socket = sockfd_to_socket(sockfd);
|
|
|
|
|
|
|
+ socket = sockfd_lookup(sockfd, &err);
|
|
|
if (!socket)
|
|
if (!socket)
|
|
|
goto err;
|
|
goto err;
|
|
|
|
|
|
|
@@ -138,7 +138,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
|
|
|
err:
|
|
err:
|
|
|
spin_unlock_irq(&sdev->ud.lock);
|
|
spin_unlock_irq(&sdev->ud.lock);
|
|
|
- return err;
|
|
|
|
|
|
|
+ return -EINVAL;
|
|
|
}
|
|
}
|
|
|
static DEVICE_ATTR(usbip_sockfd, S_IWUSR, NULL, store_sockfd);
|
|
static DEVICE_ATTR(usbip_sockfd, S_IWUSR, NULL, store_sockfd);
|
|
|
|
|
|
|
@@ -208,7 +208,7 @@ static void stub_shutdown_connection(struct usbip_device *ud)
|
|
|
* not touch NULL socket.
|
|
* not touch NULL socket.
|
|
|
*/
|
|
*/
|
|
|
if (ud->tcp_socket) {
|
|
if (ud->tcp_socket) {
|
|
|
- fput(ud->tcp_socket->file);
|
|
|
|
|
|
|
+ sockfd_put(ud->tcp_socket);
|
|
|
ud->tcp_socket = NULL;
|
|
ud->tcp_socket = NULL;
|
|
|
}
|
|
}
|
|
|
|
|
|