*/
#include <linux/device.h>
+#include <linux/file.h>
#include <linux/kthread.h>
#include <linux/module.h>
* not touch NULL socket.
*/
if (ud->tcp_socket) {
- sock_release(ud->tcp_socket);
+ fput(ud->tcp_socket->file);
ud->tcp_socket = NULL;
}
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);
*/
#include <linux/init.h>
+#include <linux/file.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/module.h>
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");
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);
*/
#include <linux/kthread.h>
+#include <linux/file.h>
#include <linux/net.h>
#include "usbip_common.h"
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;
spin_unlock(&vdev->ud.lock);
spin_unlock(&the_controller->lock);
+ fput(socket->file);
+
dev_err(dev, "port %d already used\n", rhport);
return -EINVAL;
}