From: Sasha Levin Date: Thu, 12 Sep 2024 12:21:01 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v6.1.111~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=776394ceb0b2dcf72c432062fb5c2b43291a1098;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/net-ethernet-use-ip_hdrlen-instead-of-bit-shift.patch b/queue-4.19/net-ethernet-use-ip_hdrlen-instead-of-bit-shift.patch new file mode 100644 index 00000000000..52d2a20985b --- /dev/null +++ b/queue-4.19/net-ethernet-use-ip_hdrlen-instead-of-bit-shift.patch @@ -0,0 +1,50 @@ +From fe53bb3cc926c7208c369ca3683ceb6ca43dd93a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Aug 2024 19:07:21 +0900 +Subject: net: ethernet: use ip_hdrlen() instead of bit shift + +From: Moon Yeounsu + +[ Upstream commit 9a039eeb71a42c8b13408a1976e300f3898e1be0 ] + +`ip_hdr(skb)->ihl << 2` is the same as `ip_hdrlen(skb)` +Therefore, we should use a well-defined function not a bit shift +to find the header length. + +It also compresses two lines to a single line. + +Signed-off-by: Moon Yeounsu +Reviewed-by: Christophe JAILLET +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/jme.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c +index a5ab6f3403ae..9b2471b2a955 100644 +--- a/drivers/net/ethernet/jme.c ++++ b/drivers/net/ethernet/jme.c +@@ -966,15 +966,13 @@ jme_udpsum(struct sk_buff *skb) + if (skb->protocol != htons(ETH_P_IP)) + return csum; + skb_set_network_header(skb, ETH_HLEN); +- if ((ip_hdr(skb)->protocol != IPPROTO_UDP) || +- (skb->len < (ETH_HLEN + +- (ip_hdr(skb)->ihl << 2) + +- sizeof(struct udphdr)))) { ++ ++ if (ip_hdr(skb)->protocol != IPPROTO_UDP || ++ skb->len < (ETH_HLEN + ip_hdrlen(skb) + sizeof(struct udphdr))) { + skb_reset_network_header(skb); + return csum; + } +- skb_set_transport_header(skb, +- ETH_HLEN + (ip_hdr(skb)->ihl << 2)); ++ skb_set_transport_header(skb, ETH_HLEN + ip_hdrlen(skb)); + csum = udp_hdr(skb)->check; + skb_reset_transport_header(skb); + skb_reset_network_header(skb); +-- +2.43.0 + diff --git a/queue-4.19/net-phy-vitesse-repair-vsc73xx-autonegotiation.patch b/queue-4.19/net-phy-vitesse-repair-vsc73xx-autonegotiation.patch new file mode 100644 index 00000000000..b9707fc6770 --- /dev/null +++ b/queue-4.19/net-phy-vitesse-repair-vsc73xx-autonegotiation.patch @@ -0,0 +1,76 @@ +From f5302afab21a1ecbe7229e8999c1afebd988524e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Aug 2024 21:38:06 +0200 +Subject: net: phy: vitesse: repair vsc73xx autonegotiation + +From: Pawel Dembicki + +[ Upstream commit de7a670f8defe4ed2115552ad23dea0f432f7be4 ] + +When the vsc73xx mdio bus work properly, the generic autonegotiation +configuration works well. + +Reviewed-by: Linus Walleij +Signed-off-by: Pawel Dembicki +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/phy/vitesse.c | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c +index fbf9ad429593..697b07fdf3ec 100644 +--- a/drivers/net/phy/vitesse.c ++++ b/drivers/net/phy/vitesse.c +@@ -241,16 +241,6 @@ static int vsc739x_config_init(struct phy_device *phydev) + return genphy_config_init(phydev); + } + +-static int vsc73xx_config_aneg(struct phy_device *phydev) +-{ +- /* The VSC73xx switches does not like to be instructed to +- * do autonegotiation in any way, it prefers that you just go +- * with the power-on/reset defaults. Writing some registers will +- * just make autonegotiation permanently fail. +- */ +- return 0; +-} +- + /* This adds a skew for both TX and RX clocks, so the skew should only be + * applied to "rgmii-id" interfaces. It may not work as expected + * on "rgmii-txid", "rgmii-rxid" or "rgmii" interfaces. */ +@@ -459,7 +449,6 @@ static struct phy_driver vsc82xx_driver[] = { + .phy_id_mask = 0x000ffff0, + .features = PHY_GBIT_FEATURES, + .config_init = vsc738x_config_init, +- .config_aneg = vsc73xx_config_aneg, + .read_page = vsc73xx_read_page, + .write_page = vsc73xx_write_page, + }, { +@@ -468,7 +457,6 @@ static struct phy_driver vsc82xx_driver[] = { + .phy_id_mask = 0x000ffff0, + .features = PHY_GBIT_FEATURES, + .config_init = vsc738x_config_init, +- .config_aneg = vsc73xx_config_aneg, + .read_page = vsc73xx_read_page, + .write_page = vsc73xx_write_page, + }, { +@@ -477,7 +465,6 @@ static struct phy_driver vsc82xx_driver[] = { + .phy_id_mask = 0x000ffff0, + .features = PHY_GBIT_FEATURES, + .config_init = vsc739x_config_init, +- .config_aneg = vsc73xx_config_aneg, + .read_page = vsc73xx_read_page, + .write_page = vsc73xx_write_page, + }, { +@@ -486,7 +473,6 @@ static struct phy_driver vsc82xx_driver[] = { + .phy_id_mask = 0x000ffff0, + .features = PHY_GBIT_FEATURES, + .config_init = vsc739x_config_init, +- .config_aneg = vsc73xx_config_aneg, + .read_page = vsc73xx_read_page, + .write_page = vsc73xx_write_page, + }, { +-- +2.43.0 + diff --git a/queue-4.19/scripts-kconfig-merge_config-config-files-add-a-trai.patch b/queue-4.19/scripts-kconfig-merge_config-config-files-add-a-trai.patch new file mode 100644 index 00000000000..5b11d4ff944 --- /dev/null +++ b/queue-4.19/scripts-kconfig-merge_config-config-files-add-a-trai.patch @@ -0,0 +1,48 @@ +From df5a891bf8141de60f052d7f5298ee396cc6ebfd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Aug 2024 11:22:34 +0200 +Subject: scripts: kconfig: merge_config: config files: add a trailing newline + +From: Anders Roxell + +[ Upstream commit 33330bcf031818e60a816db0cfd3add9eecc3b28 ] + +When merging files without trailing newlines at the end of the file, two +config fragments end up at the same row if file1.config doens't have a +trailing newline at the end of the file. + +file1.config "CONFIG_1=y" +file2.config "CONFIG_2=y" +./scripts/kconfig/merge_config.sh -m .config file1.config file2.config + +This will generate a .config looking like this. +cat .config +... +CONFIG_1=yCONFIG_2=y" + +Making sure so we add a newline at the end of every config file that is +passed into the script. + +Signed-off-by: Anders Roxell +Signed-off-by: Masahiro Yamada +Signed-off-by: Sasha Levin +--- + scripts/kconfig/merge_config.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh +index 67d131447631..6b918882d32c 100755 +--- a/scripts/kconfig/merge_config.sh ++++ b/scripts/kconfig/merge_config.sh +@@ -128,6 +128,8 @@ for MERGE_FILE in $MERGE_LIST ; do + fi + sed -i "/$CFG[ =]/d" $TMP_FILE + done ++ # In case the previous file lacks a new line at the end ++ echo >> $TMP_FILE + cat $MERGE_FILE >> $TMP_FILE + done + +-- +2.43.0 + diff --git a/queue-4.19/series b/queue-4.19/series new file mode 100644 index 00000000000..2763e5e9263 --- /dev/null +++ b/queue-4.19/series @@ -0,0 +1,7 @@ +staging-iio-frequency-ad9833-get-frequency-value-sta.patch +staging-iio-frequency-ad9833-load-clock-using-clock-.patch +staging-iio-frequency-ad9834-validate-frequency-para.patch +usbnet-ipheth-fix-carrier-detection-in-modes-1-and-4.patch +net-ethernet-use-ip_hdrlen-instead-of-bit-shift.patch +net-phy-vitesse-repair-vsc73xx-autonegotiation.patch +scripts-kconfig-merge_config-config-files-add-a-trai.patch diff --git a/queue-4.19/staging-iio-frequency-ad9833-get-frequency-value-sta.patch b/queue-4.19/staging-iio-frequency-ad9833-get-frequency-value-sta.patch new file mode 100644 index 00000000000..fabf0771db1 --- /dev/null +++ b/queue-4.19/staging-iio-frequency-ad9833-get-frequency-value-sta.patch @@ -0,0 +1,130 @@ +From 36cfef1e391bc53bf6ddc797e48ed4cd5613098b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Feb 2019 17:01:37 +0200 +Subject: staging: iio: frequency: ad9833: Get frequency value statically + +From: Beniamin Bia + +[ Upstream commit 80109c32348d7b2e85def9efc3f9524fb166569d ] + +The values from platform data were replaced by statically values. +This was just a intermediate step of taking this driver out of staging and +load data from device tree. + +Signed-off-by: Beniamin Bia +Signed-off-by: Jonathan Cameron +Stable-dep-of: b48aa9917589 ("staging: iio: frequency: ad9834: Validate frequency parameter value") +Signed-off-by: Sasha Levin +--- + drivers/staging/iio/frequency/ad9834.c | 21 +++++++------------ + drivers/staging/iio/frequency/ad9834.h | 28 -------------------------- + 2 files changed, 7 insertions(+), 42 deletions(-) + +diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c +index 4c6d4043903e..f6b36eedd48e 100644 +--- a/drivers/staging/iio/frequency/ad9834.c ++++ b/drivers/staging/iio/frequency/ad9834.c +@@ -389,16 +389,11 @@ static const struct iio_info ad9833_info = { + + static int ad9834_probe(struct spi_device *spi) + { +- struct ad9834_platform_data *pdata = dev_get_platdata(&spi->dev); + struct ad9834_state *st; + struct iio_dev *indio_dev; + struct regulator *reg; + int ret; + +- if (!pdata) { +- dev_dbg(&spi->dev, "no platform data?\n"); +- return -ENODEV; +- } + + reg = devm_regulator_get(&spi->dev, "avdd"); + if (IS_ERR(reg)) +@@ -418,7 +413,7 @@ static int ad9834_probe(struct spi_device *spi) + spi_set_drvdata(spi, indio_dev); + st = iio_priv(indio_dev); + mutex_init(&st->lock); +- st->mclk = pdata->mclk; ++ st->mclk = 25000000; + st->spi = spi; + st->devid = spi_get_device_id(spi)->driver_data; + st->reg = reg; +@@ -454,11 +449,9 @@ static int ad9834_probe(struct spi_device *spi) + spi_message_add_tail(&st->freq_xfer[1], &st->freq_msg); + + st->control = AD9834_B28 | AD9834_RESET; ++ st->control |= AD9834_DIV2; + +- if (!pdata->en_div2) +- st->control |= AD9834_DIV2; +- +- if (!pdata->en_signbit_msb_out && (st->devid == ID_AD9834)) ++ if (st->devid == ID_AD9834) + st->control |= AD9834_SIGN_PIB; + + st->data = cpu_to_be16(AD9834_REG_CMD | st->control); +@@ -468,19 +461,19 @@ static int ad9834_probe(struct spi_device *spi) + goto error_disable_reg; + } + +- ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, pdata->freq0); ++ ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, 1000000); + if (ret) + goto error_disable_reg; + +- ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, pdata->freq1); ++ ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, 5000000); + if (ret) + goto error_disable_reg; + +- ret = ad9834_write_phase(st, AD9834_REG_PHASE0, pdata->phase0); ++ ret = ad9834_write_phase(st, AD9834_REG_PHASE0, 512); + if (ret) + goto error_disable_reg; + +- ret = ad9834_write_phase(st, AD9834_REG_PHASE1, pdata->phase1); ++ ret = ad9834_write_phase(st, AD9834_REG_PHASE1, 1024); + if (ret) + goto error_disable_reg; + +diff --git a/drivers/staging/iio/frequency/ad9834.h b/drivers/staging/iio/frequency/ad9834.h +index ae620f38eb49..da7e83ceedad 100644 +--- a/drivers/staging/iio/frequency/ad9834.h ++++ b/drivers/staging/iio/frequency/ad9834.h +@@ -8,32 +8,4 @@ + #ifndef IIO_DDS_AD9834_H_ + #define IIO_DDS_AD9834_H_ + +-/* +- * TODO: struct ad7887_platform_data needs to go into include/linux/iio +- */ +- +-/** +- * struct ad9834_platform_data - platform specific information +- * @mclk: master clock in Hz +- * @freq0: power up freq0 tuning word in Hz +- * @freq1: power up freq1 tuning word in Hz +- * @phase0: power up phase0 value [0..4095] correlates with 0..2PI +- * @phase1: power up phase1 value [0..4095] correlates with 0..2PI +- * @en_div2: digital output/2 is passed to the SIGN BIT OUT pin +- * @en_signbit_msb_out: the MSB (or MSB/2) of the DAC data is connected to the +- * SIGN BIT OUT pin. en_div2 controls whether it is the MSB +- * or MSB/2 that is output. if en_signbit_msb_out=false, +- * the on-board comparator is connected to SIGN BIT OUT +- */ +- +-struct ad9834_platform_data { +- unsigned int mclk; +- unsigned int freq0; +- unsigned int freq1; +- unsigned short phase0; +- unsigned short phase1; +- bool en_div2; +- bool en_signbit_msb_out; +-}; +- + #endif /* IIO_DDS_AD9834_H_ */ +-- +2.43.0 + diff --git a/queue-4.19/staging-iio-frequency-ad9833-load-clock-using-clock-.patch b/queue-4.19/staging-iio-frequency-ad9833-load-clock-using-clock-.patch new file mode 100644 index 00000000000..bef779f982d --- /dev/null +++ b/queue-4.19/staging-iio-frequency-ad9833-load-clock-using-clock-.patch @@ -0,0 +1,129 @@ +From 2d96a4c2a1ae051e69d87a8a0b9aa759e544795d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Feb 2019 17:01:38 +0200 +Subject: staging: iio: frequency: ad9833: Load clock using clock framework + +From: Beniamin Bia + +[ Upstream commit 8e8040c52e63546d1171c188a24aacf145a9a7e0 ] + +The clock frequency is loaded from device-tree using clock framework +instead of statically value. The change allow configuration of +the device via device-trees and better initialization sequence. +This is part of broader effort to add device-tree support to this driver +and take it out from staging. + +Signed-off-by: Beniamin Bia +Signed-off-by: Jonathan Cameron +Stable-dep-of: b48aa9917589 ("staging: iio: frequency: ad9834: Validate frequency parameter value") +Signed-off-by: Sasha Levin +--- + drivers/staging/iio/frequency/ad9834.c | 35 ++++++++++++++++++-------- + 1 file changed, 24 insertions(+), 11 deletions(-) + +diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c +index f6b36eedd48e..5e98ee5dfbdc 100644 +--- a/drivers/staging/iio/frequency/ad9834.c ++++ b/drivers/staging/iio/frequency/ad9834.c +@@ -6,6 +6,7 @@ + * Licensed under the GPL-2. + */ + ++#include + #include + #include + #include +@@ -71,7 +72,7 @@ + struct ad9834_state { + struct spi_device *spi; + struct regulator *reg; +- unsigned int mclk; ++ struct clk *mclk; + unsigned short control; + unsigned short devid; + struct spi_transfer xfer; +@@ -110,12 +111,15 @@ static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout) + static int ad9834_write_frequency(struct ad9834_state *st, + unsigned long addr, unsigned long fout) + { ++ unsigned long clk_freq; + unsigned long regval; + +- if (fout > (st->mclk / 2)) ++ clk_freq = clk_get_rate(st->mclk); ++ ++ if (fout > (clk_freq / 2)) + return -EINVAL; + +- regval = ad9834_calc_freqreg(st->mclk, fout); ++ regval = ad9834_calc_freqreg(clk_freq, fout); + + st->freq_data[0] = cpu_to_be16(addr | (regval & + RES_MASK(AD9834_FREQ_BITS / 2))); +@@ -413,7 +417,14 @@ static int ad9834_probe(struct spi_device *spi) + spi_set_drvdata(spi, indio_dev); + st = iio_priv(indio_dev); + mutex_init(&st->lock); +- st->mclk = 25000000; ++ st->mclk = devm_clk_get(&spi->dev, NULL); ++ ++ ret = clk_prepare_enable(st->mclk); ++ if (ret) { ++ dev_err(&spi->dev, "Failed to enable master clock\n"); ++ goto error_disable_reg; ++ } ++ + st->spi = spi; + st->devid = spi_get_device_id(spi)->driver_data; + st->reg = reg; +@@ -458,31 +469,32 @@ static int ad9834_probe(struct spi_device *spi) + ret = spi_sync(st->spi, &st->msg); + if (ret) { + dev_err(&spi->dev, "device init failed\n"); +- goto error_disable_reg; ++ goto error_clock_unprepare; + } + + ret = ad9834_write_frequency(st, AD9834_REG_FREQ0, 1000000); + if (ret) +- goto error_disable_reg; ++ goto error_clock_unprepare; + + ret = ad9834_write_frequency(st, AD9834_REG_FREQ1, 5000000); + if (ret) +- goto error_disable_reg; ++ goto error_clock_unprepare; + + ret = ad9834_write_phase(st, AD9834_REG_PHASE0, 512); + if (ret) +- goto error_disable_reg; ++ goto error_clock_unprepare; + + ret = ad9834_write_phase(st, AD9834_REG_PHASE1, 1024); + if (ret) +- goto error_disable_reg; ++ goto error_clock_unprepare; + + ret = iio_device_register(indio_dev); + if (ret) +- goto error_disable_reg; ++ goto error_clock_unprepare; + + return 0; +- ++error_clock_unprepare: ++ clk_disable_unprepare(st->mclk); + error_disable_reg: + regulator_disable(reg); + +@@ -495,6 +507,7 @@ static int ad9834_remove(struct spi_device *spi) + struct ad9834_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); ++ clk_disable_unprepare(st->mclk); + regulator_disable(st->reg); + + return 0; +-- +2.43.0 + diff --git a/queue-4.19/staging-iio-frequency-ad9834-validate-frequency-para.patch b/queue-4.19/staging-iio-frequency-ad9834-validate-frequency-para.patch new file mode 100644 index 00000000000..5bf549a1c42 --- /dev/null +++ b/queue-4.19/staging-iio-frequency-ad9834-validate-frequency-para.patch @@ -0,0 +1,47 @@ +From 3c04f4e08e763d34367282d63921d4a9f058578a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Jul 2024 18:45:06 +0300 +Subject: staging: iio: frequency: ad9834: Validate frequency parameter value + +From: Aleksandr Mishin + +[ Upstream commit b48aa991758999d4e8f9296c5bbe388f293ef465 ] + +In ad9834_write_frequency() clk_get_rate() can return 0. In such case +ad9834_calc_freqreg() call will lead to division by zero. Checking +'if (fout > (clk_freq / 2))' doesn't protect in case of 'fout' is 0. +ad9834_write_frequency() is called from ad9834_write(), where fout is +taken from text buffer, which can contain any value. + +Modify parameters checking. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: 12b9d5bf76bf ("Staging: IIO: DDS: AD9833 / AD9834 driver") +Suggested-by: Dan Carpenter +Signed-off-by: Aleksandr Mishin +Reviewed-by: Dan Carpenter +Link: https://patch.msgid.link/20240703154506.25584-1-amishin@t-argos.ru +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/staging/iio/frequency/ad9834.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c +index 5e98ee5dfbdc..3eb089dc220e 100644 +--- a/drivers/staging/iio/frequency/ad9834.c ++++ b/drivers/staging/iio/frequency/ad9834.c +@@ -116,7 +116,7 @@ static int ad9834_write_frequency(struct ad9834_state *st, + + clk_freq = clk_get_rate(st->mclk); + +- if (fout > (clk_freq / 2)) ++ if (!clk_freq || fout > (clk_freq / 2)) + return -EINVAL; + + regval = ad9834_calc_freqreg(clk_freq, fout); +-- +2.43.0 + diff --git a/queue-4.19/usbnet-ipheth-fix-carrier-detection-in-modes-1-and-4.patch b/queue-4.19/usbnet-ipheth-fix-carrier-detection-in-modes-1-and-4.patch new file mode 100644 index 00000000000..8af76d45a20 --- /dev/null +++ b/queue-4.19/usbnet-ipheth-fix-carrier-detection-in-modes-1-and-4.patch @@ -0,0 +1,80 @@ +From bbfb00c67c7f3f91b94b7c9b0efdf2f7cfe5fe55 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Aug 2024 19:28:09 +0200 +Subject: usbnet: ipheth: fix carrier detection in modes 1 and 4 + +From: Foster Snowhill + +[ Upstream commit 67927a1b255d883881be9467508e0af9a5e0be9d ] + +Apart from the standard "configurations", "interfaces" and "alternate +interface settings" in USB, iOS devices also have a notion of +"modes". In different modes, the device exposes a different set of +available configurations. + +Depending on the iOS version, and depending on the current mode, the +length and contents of the carrier state control message differs: + +* 1 byte (seen on iOS 4.2.1, 8.4): + * 03: carrier off (mode 0) + * 04: carrier on (mode 0) +* 3 bytes (seen on iOS 10.3.4, 15.7.6): + * 03 03 03: carrier off (mode 0) + * 04 04 03: carrier on (mode 0) +* 4 bytes (seen on iOS 16.5, 17.6): + * 03 03 03 00: carrier off (mode 0) + * 04 03 03 00: carrier off (mode 1) + * 06 03 03 00: carrier off (mode 4) + * 04 04 03 04: carrier on (mode 0 and 1) + * 06 04 03 04: carrier on (mode 4) + +Before this change, the driver always used the first byte of the +response to determine carrier state. + +From this larger sample, the first byte seems to indicate the number of +available USB configurations in the current mode (with the exception of +the default mode 0), and in some cases (namely mode 1 and 4) does not +correlate with the carrier state. + +Previous logic erroneously counted `04 03 03 00` as "carrier on" and +`06 04 03 04` as "carrier off" on iOS versions that support mode 1 and +mode 4 respectively. + +Only modes 0, 1 and 4 expose the USB Ethernet interfaces necessary for +the ipheth driver. + +Check the second byte of the control message where possible, and fall +back to checking the first byte on older iOS versions. + +Signed-off-by: Foster Snowhill +Tested-by: Georgi Valkov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/ipheth.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c +index 0a86ba028c4d..6a3a4504767f 100644 +--- a/drivers/net/usb/ipheth.c ++++ b/drivers/net/usb/ipheth.c +@@ -307,13 +307,14 @@ static int ipheth_carrier_set(struct ipheth_device *dev) + 0x02, /* index */ + dev->ctrl_buf, IPHETH_CTRL_BUF_SIZE, + IPHETH_CTRL_TIMEOUT); +- if (retval < 0) { ++ if (retval <= 0) { + dev_err(&dev->intf->dev, "%s: usb_control_msg: %d\n", + __func__, retval); + return retval; + } + +- if (dev->ctrl_buf[0] == IPHETH_CARRIER_ON) { ++ if ((retval == 1 && dev->ctrl_buf[0] == IPHETH_CARRIER_ON) || ++ (retval >= 2 && dev->ctrl_buf[1] == IPHETH_CARRIER_ON)) { + netif_carrier_on(dev->net); + if (dev->tx_urb->status != -EINPROGRESS) + netif_wake_queue(dev->net); +-- +2.43.0 +