From 2cfe06728ce18af0acd6f841d352dadabbe3b34b Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 16 Apr 2020 23:43:41 -0400 Subject: [PATCH] Fixes for 4.14 Signed-off-by: Sasha Levin --- ...n2-fix-sanity-checking-for-endpoints.patch | 61 +++++++++++++++++++ queue-4.14/series | 1 + 2 files changed, 62 insertions(+) create mode 100644 queue-4.14/mfd-dln2-fix-sanity-checking-for-endpoints.patch diff --git a/queue-4.14/mfd-dln2-fix-sanity-checking-for-endpoints.patch b/queue-4.14/mfd-dln2-fix-sanity-checking-for-endpoints.patch new file mode 100644 index 00000000000..b01a3d7843f --- /dev/null +++ b/queue-4.14/mfd-dln2-fix-sanity-checking-for-endpoints.patch @@ -0,0 +1,61 @@ +From d1c2ea9b58a45caaefd66b8aff8b1141d0eb3373 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Feb 2020 16:51:58 +0200 +Subject: mfd: dln2: Fix sanity checking for endpoints + +From: Andy Shevchenko + +[ Upstream commit fb945c95a482200876993977008b67ea658bd938 ] + +While the commit 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints") +tries to harden the sanity checks it made at the same time a regression, +i.e. mixed in and out endpoints. Obviously it should have been not tested on +real hardware at that time, but unluckily it didn't happen. + +So, fix above mentioned typo and make device being enumerated again. + +While here, introduce an enumerator for magic values to prevent similar issue +to happen in the future. + +Fixes: 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints") +Cc: Oliver Neukum +Cc: Greg Kroah-Hartman +Signed-off-by: Andy Shevchenko +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/mfd/dln2.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c +index 95d0f2df0ad42..672831d5ee32e 100644 +--- a/drivers/mfd/dln2.c ++++ b/drivers/mfd/dln2.c +@@ -93,6 +93,11 @@ struct dln2_mod_rx_slots { + spinlock_t lock; + }; + ++enum dln2_endpoint { ++ DLN2_EP_OUT = 0, ++ DLN2_EP_IN = 1, ++}; ++ + struct dln2_dev { + struct usb_device *usb_dev; + struct usb_interface *interface; +@@ -740,10 +745,10 @@ static int dln2_probe(struct usb_interface *interface, + hostif->desc.bNumEndpoints < 2) + return -ENODEV; + +- epin = &hostif->endpoint[0].desc; +- epout = &hostif->endpoint[1].desc; ++ epout = &hostif->endpoint[DLN2_EP_OUT].desc; + if (!usb_endpoint_is_bulk_out(epout)) + return -ENODEV; ++ epin = &hostif->endpoint[DLN2_EP_IN].desc; + if (!usb_endpoint_is_bulk_in(epin)) + return -ENODEV; + +-- +2.20.1 + diff --git a/queue-4.14/series b/queue-4.14/series index 406ba5571ca..8122a02b6c7 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -102,3 +102,4 @@ ftrace-kprobe-show-the-maxactive-number-on-kprobe_ev.patch ipmi-fix-hung-processes-in-__get_guid.patch powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch misc-echo-remove-unnecessary-parentheses-and-simplif.patch +mfd-dln2-fix-sanity-checking-for-endpoints.patch -- 2.47.3