[kbuild] [sashal-linux-stable:queue-4.9 26/29] drivers/usb/usbip/vudc_sysfs.c:238 store_sockfd() warn: inconsistent returns '>ud.sysfs_lock'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git queue-4.9 head: 7edb2da8d62438a92699cb11688ad9f372fc32fc commit: 117246f8e1e52f36549f8e420418f4673d4ddca2 [26/29] usbip: vudc synchronize sysfs code paths config: arc-randconfig-m031-20210425 (attached as .config) compiler: arceb-elf-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/usb/usbip/vudc_sysfs.c:238 store_sockfd() warn: inconsistent returns '>ud.sysfs_lock'. vim +238 drivers/usb/usbip/vudc_sysfs.c fe9e15a30be666 Shuah Khan 2021-03-07 106 static ssize_t store_sockfd(struct device *dev, fe9e15a30be666 Shuah Khan 2021-03-07 107 struct device_attribute *attr, ea6873a45a22f3 Igor Kotrasinski 2016-03-08 108 const char *in, size_t count) ea6873a45a22f3 Igor Kotrasinski 2016-03-08 109 { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 110 struct vudc *udc = (struct vudc *) dev_get_drvdata(dev); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 111 int rv; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 112 int sockfd = 0; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 113 int err; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 114 struct socket *socket; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 115 unsigned long flags; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 116 int ret; fe9e15a30be666 Shuah Khan 2021-03-07 117 struct task_struct *tcp_rx = NULL; fe9e15a30be666 Shuah Khan 2021-03-07 118 struct task_struct *tcp_tx = NULL; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 119 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 120 rv = kstrtoint(in, 0, ); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 121 if (rv != 0) ea6873a45a22f3 Igor Kotrasinski 2016-03-08 122 return -EINVAL; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 123 b7661e9af851da Colin Ian King 2018-02-22 124 if (!udc) { b7661e9af851da Colin Ian King 2018-02-22 125 dev_err(dev, "no device"); b7661e9af851da Colin Ian King 2018-02-22 126 return -ENODEV; b7661e9af851da Colin Ian King 2018-02-22 127 } 117246f8e1e52f Shuah Khan 2021-04-16 128 mutex_lock(>ud.sysfs_lock); ^^^ ea6873a45a22f3 Igor Kotrasinski 2016-03-08 129 spin_lock_irqsave(>lock, flags); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 130 /* Don't export what we don't have */ b7661e9af851da Colin Ian King 2018-02-22 131 if (!udc->driver || !udc->pullup) { b7661e9af851da Colin Ian King 2018-02-22 132 dev_err(dev, "gadget not bound"); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 133 ret = -ENODEV; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 134 goto unlock; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 135 } ea6873a45a22f3 Igor Kotrasinski 2016-03-08 136 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 137 if (sockfd != -1) { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 138 if (udc->connected) { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 139 dev_err(dev, "Device already connected"); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 140 ret = -EBUSY; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 141 goto unlock; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 142 } ea6873a45a22f3 Igor Kotrasinski 2016-03-08 143 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 144 spin_lock_irq(>ud.lock); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 145 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 146 if (udc->ud.status != SDEV_ST_AVAILABLE) { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 147 ret = -EINVAL; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 148 goto unlock_ud; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 149 } ea6873a45a22f3 Igor Kotrasinski 2016-03-08 150 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 151 socket = sockfd_lookup(sockfd, ); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 152 if (!socket) { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 153 dev_err(dev, "failed to lookup sock"); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 154 ret = -EINVAL; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 155 goto unlock_ud; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 156 } ea6873a45a22f3 Igor Kotrasinski 2016-03-08 157 d5708a353836ac Shuah Khan 2021-03-07 158 if (socket->type != SOCK_STREAM) { d5708a353836ac Shuah Khan 2021-03-07 159
[kbuild] [sashal-linux-stable:queue-4.9 26/29] drivers/usb/usbip/vudc_sysfs.c:238 store_sockfd() warn: inconsistent returns '>ud.sysfs_lock'.
CC: kbuild-...@lists.01.org TO: Sasha Levin tree: https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git queue-4.9 head: 7edb2da8d62438a92699cb11688ad9f372fc32fc commit: 117246f8e1e52f36549f8e420418f4673d4ddca2 [26/29] usbip: vudc synchronize sysfs code paths :: branch date: 4 hours ago :: commit date: 4 hours ago config: arc-randconfig-m031-20210425 (attached as .config) compiler: arceb-elf-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/usb/usbip/vudc_sysfs.c:238 store_sockfd() warn: inconsistent returns '>ud.sysfs_lock'. vim +238 drivers/usb/usbip/vudc_sysfs.c ea6873a45a22f3 Igor Kotrasinski 2016-03-08 105 fe9e15a30be666 Shuah Khan 2021-03-07 106 static ssize_t store_sockfd(struct device *dev, fe9e15a30be666 Shuah Khan 2021-03-07 107 struct device_attribute *attr, ea6873a45a22f3 Igor Kotrasinski 2016-03-08 108 const char *in, size_t count) ea6873a45a22f3 Igor Kotrasinski 2016-03-08 109 { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 110 struct vudc *udc = (struct vudc *) dev_get_drvdata(dev); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 111 int rv; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 112 int sockfd = 0; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 113 int err; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 114 struct socket *socket; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 115 unsigned long flags; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 116 int ret; fe9e15a30be666 Shuah Khan 2021-03-07 117 struct task_struct *tcp_rx = NULL; fe9e15a30be666 Shuah Khan 2021-03-07 118 struct task_struct *tcp_tx = NULL; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 119 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 120 rv = kstrtoint(in, 0, ); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 121 if (rv != 0) ea6873a45a22f3 Igor Kotrasinski 2016-03-08 122 return -EINVAL; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 123 b7661e9af851da Colin Ian King 2018-02-22 124 if (!udc) { b7661e9af851da Colin Ian King 2018-02-22 125 dev_err(dev, "no device"); b7661e9af851da Colin Ian King 2018-02-22 126 return -ENODEV; b7661e9af851da Colin Ian King 2018-02-22 127 } 117246f8e1e52f Shuah Khan 2021-04-16 128 mutex_lock(>ud.sysfs_lock); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 129 spin_lock_irqsave(>lock, flags); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 130 /* Don't export what we don't have */ b7661e9af851da Colin Ian King 2018-02-22 131 if (!udc->driver || !udc->pullup) { b7661e9af851da Colin Ian King 2018-02-22 132 dev_err(dev, "gadget not bound"); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 133 ret = -ENODEV; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 134 goto unlock; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 135 } ea6873a45a22f3 Igor Kotrasinski 2016-03-08 136 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 137 if (sockfd != -1) { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 138 if (udc->connected) { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 139 dev_err(dev, "Device already connected"); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 140 ret = -EBUSY; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 141 goto unlock; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 142 } ea6873a45a22f3 Igor Kotrasinski 2016-03-08 143 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 144 spin_lock_irq(>ud.lock); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 145 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 146 if (udc->ud.status != SDEV_ST_AVAILABLE) { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 147 ret = -EINVAL; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 148 goto unlock_ud; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 149 } ea6873a45a22f3 Igor Kotrasinski 2016-03-08 150 ea6873a45a22f3 Igor Kotrasinski 2016-03-08 151 socket = sockfd_lookup(sockfd, ); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 152 if (!socket) { ea6873a45a22f3 Igor Kotrasinski 2016-03-08 153 dev_err(dev, "failed to lookup sock"); ea6873a45a22f3 Igor Kotrasinski 2016-03-08 154 ret = -EINVAL; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 155 goto unlock_ud; ea6873a45a22f3 Igor Kotrasinski 2016-03-08 156 } ea6873a45a22f3 Igor Kotrasinski 2016-03-08 157 d5708a353836ac Shuah Khan 2021-03-07 158 if (socket->type !=