diff options
author | Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> | 2023-12-19 07:36:35 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-02 14:41:51 +0100 |
commit | e7d3b9f28654dbfce7e09f8028210489adaf6a33 (patch) | |
tree | 1293e2b4927720cf96d7161e58c1caec720c3d77 /drivers/usb/misc | |
parent | usb: typec: tipd: add patch update support for tps6598x (diff) | |
download | linux-e7d3b9f28654dbfce7e09f8028210489adaf6a33.tar.xz linux-e7d3b9f28654dbfce7e09f8028210489adaf6a33.zip |
usb: yurex: Fix inconsistent locking bug in yurex_read()
Unlock before returning on the error path.
Fixes: 86b20af11e84 ("usb: yurex: Replace snprintf() with the safer scnprintf() variant")
Reported-by: Dan Carpenter <error27@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202312170252.3udgrIcP-lkp@intel.com/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/r/20231219063639.450994-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/yurex.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 5a13cddace0e..9a0649d23693 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c @@ -414,8 +414,10 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, return -ENODEV; } - if (WARN_ON_ONCE(dev->bbu > S64_MAX || dev->bbu < S64_MIN)) + if (WARN_ON_ONCE(dev->bbu > S64_MAX || dev->bbu < S64_MIN)) { + mutex_unlock(&dev->io_mutex); return -EIO; + } spin_lock_irqsave(&dev->lock, flags); scnprintf(in_buffer, MAX_S64_STRLEN, "%lld\n", dev->bbu); |