android_kernel_motorola_sm6375/drivers/usb
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Quentin Perret f0c4a768cf UPSTREAM: ehci-hcd: Move include to keep CRC stable
The CRC calculation done by genksyms is triggered when the parser hits
EXPORT_SYMBOL*() macros. At this point, genksyms recursively expands the
types of the function parameters, and uses that as the input for the CRC
calculation. In the case of forward-declared structs, the type expands
to 'UNKNOWN'. Following this, it appears that the result of the
expansion of each type is cached somewhere, and seems to be re-used
when/if the same type is seen again for another exported symbol in the
same C file.

Unfortunately, this can cause CRC 'stability' issues when a struct
definition becomes visible in the middle of a C file. For example, let's
assume code with the following pattern:

    struct foo;

    int bar(struct foo *arg)
    {
	/* Do work ... */
    }
    EXPORT_SYMBOL_GPL(bar);

    /* This contains struct foo's definition */
    #include "foo.h"

    int baz(struct foo *arg)
    {
	/* Do more work ... */
    }
    EXPORT_SYMBOL_GPL(baz);

Here, baz's CRC will be computed using the expansion of struct foo that
was cached after bar's CRC calculation ('UNKOWN' here). But if
EXPORT_SYMBOL_GPL(bar) is removed from the file (because of e.g. symbol
trimming using CONFIG_TRIM_UNUSED_KSYMS), struct foo will be expanded
late, during baz's CRC calculation, which now has visibility over the
full struct definition, hence resulting in a different CRC for baz.

The proper fix for this certainly is in genksyms, but that will take me
some time to get right. In the meantime, we have seen one occurrence of
this in the ehci-hcd code which hits this problem because of the way it
includes C files halfway through the code together with an unlucky mix
of symbol trimming.

In order to workaround this, move the include done in ehci-hub.c early
in ehci-hcd.c, hence making sure the struct definitions are visible to
the entire file. This improves CRC stability of the ehci-hcd exports
even when symbol trimming is enabled.

Bug: 167230325
Acked-by: Alan Stern <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Quentin Perret <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 29231826f3bd65500118c473fccf31c0cf14dbc0)
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Change-Id: Ie56a4deee980652e5285a0744a8bcc2c9e60db73
2020-10-15 17:21:03 +02:00
..
atm
c67x00 USB: c67x00: fix use after free in c67x00_giveback_urb 2020-07-22 09:33:09 +02:00
cdns3 usb: cdns3: trace: fix some endian issues 2020-07-29 10:18:38 +02:00
chipidea usb: chipidea: core: add wakeup support for extcon 2020-07-22 09:33:10 +02:00
class cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip 2020-06-30 15:36:52 -04:00
common
core This is the 5.4.59 stable release 2020-08-19 08:40:57 +02:00
dwc2 usb: dwc2: Fix error path in gadget registration 2020-08-19 08:16:15 +02:00
dwc3 This is the 5.4.54 stable release 2020-07-29 13:27:01 +02:00
early
gadget This is the 5.4.59 stable release 2020-08-19 08:40:57 +02:00
host UPSTREAM: ehci-hcd: Move include to keep CRC stable 2020-10-15 17:21:03 +02:00
image
isp1760
misc USB: iowarrior: fix up report size handling for some devices 2020-08-11 15:33:32 +02:00
mon
mtu3 usb: mtu3: clear dual mode of u3port when disable device 2020-08-19 08:16:02 +02:00
musb UPSTREAM: usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle 2020-07-02 17:25:19 +00:00
phy usb: phy: twl6030-usb: Fix a resource leak in an error handling path in 'twl6030_usb_probe()' 2020-06-03 08:21:12 +02:00
renesas_usbhs usb: renesas_usbhs: getting residue from callback_result 2020-06-30 15:37:00 -04:00
roles
serial Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
storage
typec Linux 5.4.50 2020-07-01 12:46:09 +02:00
usbip
Kconfig ANDROID: GKI: Fix up "do not export symbol_get/put()" commit 2020-08-01 14:28:51 +02:00
Makefile
usb-skeleton.c