Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux.git] / drivers / staging / usbip / stub_dev.c
index 773d8ca07a004c6ec7972ae62f9be9d266c366a4..de692d7011a5cc4937298e5d3d697f519f0c9d04 100644 (file)
@@ -86,7 +86,6 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
        struct stub_device *sdev = dev_get_drvdata(dev);
        int sockfd = 0;
        struct socket *socket;
-       ssize_t err = -EINVAL;
        int rv;
 
        if (!sdev) {
@@ -99,6 +98,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
                return -EINVAL;
 
        if (sockfd != -1) {
+               int err;
                dev_info(dev, "stub up\n");
 
                spin_lock_irq(&sdev->ud.lock);
@@ -108,7 +108,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
                        goto err;
                }
 
-               socket = sockfd_to_socket(sockfd);
+               socket = sockfd_lookup(sockfd, &err);
                if (!socket)
                        goto err;
 
@@ -141,7 +141,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
 
 err:
        spin_unlock_irq(&sdev->ud.lock);
-       return err;
+       return -EINVAL;
 }
 static DEVICE_ATTR(usbip_sockfd, S_IWUSR, NULL, store_sockfd);
 
@@ -211,7 +211,7 @@ static void stub_shutdown_connection(struct usbip_device *ud)
         * not touch NULL socket.
         */
        if (ud->tcp_socket) {
-               fput(ud->tcp_socket->file);
+               sockfd_put(ud->tcp_socket);
                ud->tcp_socket = NULL;
        }