CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Johan Hovold <johan(a)kernel.org>
CC: "Greg Kroah-Hartman" <gregkh(a)linuxfoundation.org>
tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b51594df17d0ce80b9f9f35394a1f42d7ac94472
commit: 38c0d5bdf4973f9f5a888166e9d3e9ed0d32057a USB: serial: ir-usb: fix IrLAP framing
date: 7 months ago
:::::: branch date: 3 hours ago
:::::: commit date: 7 months ago
config: h8300-randconfig-m031-20200831 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/usb/serial/ir-usb.c:305 ir_write() error: double unlocked 'port->lock'
(orig line 279)
#
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 38c0d5bdf4973f9f5a888166e9d3e9ed0d32057a
vim +305 drivers/usb/serial/ir-usb.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 258
38c0d5bdf4973f Johan Hovold 2020-01-22 259 static int ir_write(struct tty_struct *tty,
struct usb_serial_port *port,
38c0d5bdf4973f Johan Hovold 2020-01-22 260 const unsigned char *buf, int count)
^1da177e4c3f41 Linus Torvalds 2005-04-16 261 {
38c0d5bdf4973f Johan Hovold 2020-01-22 262 struct urb *urb = NULL;
38c0d5bdf4973f Johan Hovold 2020-01-22 263 unsigned long flags;
38c0d5bdf4973f Johan Hovold 2020-01-22 264 int ret;
38c0d5bdf4973f Johan Hovold 2020-01-22 265
38c0d5bdf4973f Johan Hovold 2020-01-22 266 if (port->bulk_out_size == 0)
38c0d5bdf4973f Johan Hovold 2020-01-22 267 return -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 268
38c0d5bdf4973f Johan Hovold 2020-01-22 269 if (count == 0)
38c0d5bdf4973f Johan Hovold 2020-01-22 270 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 271
38c0d5bdf4973f Johan Hovold 2020-01-22 272 count = min(count, port->bulk_out_size
- 1);
38c0d5bdf4973f Johan Hovold 2020-01-22 273
38c0d5bdf4973f Johan Hovold 2020-01-22 274 spin_lock_irqsave(&port->lock,
flags);
38c0d5bdf4973f Johan Hovold 2020-01-22 275 if (__test_and_clear_bit(0,
&port->write_urbs_free)) {
38c0d5bdf4973f Johan Hovold 2020-01-22 276 urb = port->write_urbs[0];
38c0d5bdf4973f Johan Hovold 2020-01-22 277 port->tx_bytes += count;
^1da177e4c3f41 Linus Torvalds 2005-04-16 278 }
38c0d5bdf4973f Johan Hovold 2020-01-22 @279 spin_unlock_irqrestore(&port->lock,
flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 280
38c0d5bdf4973f Johan Hovold 2020-01-22 281 if (!urb)
38c0d5bdf4973f Johan Hovold 2020-01-22 282 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 283
^1da177e4c3f41 Linus Torvalds 2005-04-16 284 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 285 * The first byte of the packet we send to
the device contains an
38c0d5bdf4973f Johan Hovold 2020-01-22 286 * outbound header which indicates an
additional number of BOFs and
^1da177e4c3f41 Linus Torvalds 2005-04-16 287 * a baud rate change.
^1da177e4c3f41 Linus Torvalds 2005-04-16 288 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 289 * See section 5.4.2.2 of the USB IrDA
spec.
^1da177e4c3f41 Linus Torvalds 2005-04-16 290 */
38c0d5bdf4973f Johan Hovold 2020-01-22 291 *(u8 *)urb->transfer_buffer = ir_xbof |
ir_baud;
38c0d5bdf4973f Johan Hovold 2020-01-22 292
38c0d5bdf4973f Johan Hovold 2020-01-22 293 memcpy(urb->transfer_buffer + 1, buf,
count);
38c0d5bdf4973f Johan Hovold 2020-01-22 294
38c0d5bdf4973f Johan Hovold 2020-01-22 295 urb->transfer_buffer_length = count +
1;
38c0d5bdf4973f Johan Hovold 2020-01-22 296 urb->transfer_flags = URB_ZERO_PACKET;
38c0d5bdf4973f Johan Hovold 2020-01-22 297
38c0d5bdf4973f Johan Hovold 2020-01-22 298 ret = usb_submit_urb(urb, GFP_ATOMIC);
38c0d5bdf4973f Johan Hovold 2020-01-22 299 if (ret) {
38c0d5bdf4973f Johan Hovold 2020-01-22 300 dev_err(&port->dev, "failed
to submit write urb: %d\n", ret);
38c0d5bdf4973f Johan Hovold 2020-01-22 301
38c0d5bdf4973f Johan Hovold 2020-01-22 302 spin_lock_irqsave(&port->lock,
flags);
38c0d5bdf4973f Johan Hovold 2020-01-22 303 __set_bit(0,
&port->write_urbs_free);
38c0d5bdf4973f Johan Hovold 2020-01-22 304 port->tx_bytes -= count;
38c0d5bdf4973f Johan Hovold 2020-01-22 @305
spin_unlock_irqrestore(&port->lock, flags);
38c0d5bdf4973f Johan Hovold 2020-01-22 306
38c0d5bdf4973f Johan Hovold 2020-01-22 307 return ret;
38c0d5bdf4973f Johan Hovold 2020-01-22 308 }
38c0d5bdf4973f Johan Hovold 2020-01-22 309
38c0d5bdf4973f Johan Hovold 2020-01-22 310 return count;
38c0d5bdf4973f Johan Hovold 2020-01-22 311 }
38c0d5bdf4973f Johan Hovold 2020-01-22 312
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org