]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
USB: core: fix check for duplicate endpoints
authorJohan Hovold <johan@kernel.org>
Thu, 19 Dec 2019 16:10:16 +0000 (17:10 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commitf46f73bd5ca4149995b1eba29124fa65fd0b7c3d
treeafbcf20c428984f38e9cbf5317364f22c3f95c5f
parent9715a83a0b62c04746acc79c1d7fc9e286b57844
USB: core: fix check for duplicate endpoints

BugLink: https://bugs.launchpad.net/bugs/1861739
commit 3e4f8e21c4f27bcf30a48486b9dcc269512b79ff upstream.

Amend the endpoint-descriptor sanity checks to detect all duplicate
endpoint addresses in a configuration.

Commit 0a8fd1346254 ("USB: fix problems with duplicate endpoint
addresses") added a check for duplicate endpoint addresses within a
single alternate setting, but did not look for duplicate addresses in
other interfaces.

The current check would also not detect all duplicate addresses when one
endpoint is as a (bi-directional) control endpoint.

This specifically avoids overwriting the endpoint entries in struct
usb_device when enabling a duplicate endpoint, something which could
potentially lead to crashes or leaks, for example, when endpoints are
later disabled.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20191219161016.6695-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/core/config.c