]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
USB: class: CDC-ACM: fix race between get_serial and set_serial
authorOliver Neukum <oneukum@suse.com>
Thu, 12 Sep 2024 14:19:06 +0000 (16:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:50 +0000 (16:29 +0200)
commita0b4cbeb093620334ae42fc8e05331a632671fae
treede18b29ff619576653cdc04eb53d3c03b3a2cffc
parent7bcd961dcb5a3eaaf952e44f3d4595d7ca559baa
USB: class: CDC-ACM: fix race between get_serial and set_serial

commit b41c1fa155ba56d125885b0191aabaf3c508d0a3 upstream.

TIOCGSERIAL is an ioctl. Thus it must be atomic. It returns
two values. Racing with set_serial it can return an inconsistent
result. The mutex must be taken.

In terms of logic the bug is as old as the driver. In terms of
code it goes back to the conversion to the get_serial and
set_serial methods.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@kernel.org>
Fixes: 99f75a1fcd865 ("cdc-acm: switch to ->[sg]et_serial()")
Link: https://lore.kernel.org/r/20240912141916.1044393-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-acm.c