]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.129/lan78xx-correctly-indicate-invalid-otp.patch
3.18-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.129 / lan78xx-correctly-indicate-invalid-otp.patch
1 From foo@baz Tue Apr 17 16:59:41 CEST 2018
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Wed, 11 Apr 2018 10:59:17 +0100
4 Subject: lan78xx: Correctly indicate invalid OTP
5
6 From: Phil Elwell <phil@raspberrypi.org>
7
8
9 [ Upstream commit 4bfc33807a9a02764bdd1e42e794b3b401240f27 ]
10
11 lan78xx_read_otp tries to return -EINVAL in the event of invalid OTP
12 content, but the value gets overwritten before it is returned and the
13 read goes ahead anyway. Make the read conditional as it should be
14 and preserve the error code.
15
16 Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
17 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 drivers/net/usb/lan78xx.c | 3 ++-
22 1 file changed, 2 insertions(+), 1 deletion(-)
23
24 --- a/drivers/net/usb/lan78xx.c
25 +++ b/drivers/net/usb/lan78xx.c
26 @@ -618,7 +618,8 @@ static int lan78xx_read_otp(struct lan78
27 offset += 0x100;
28 else
29 ret = -EINVAL;
30 - ret = lan78xx_read_raw_otp(dev, offset, length, data);
31 + if (!ret)
32 + ret = lan78xx_read_raw_otp(dev, offset, length, data);
33 }
34
35 return ret;