linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT] net: asix: add proper error handling of usb read errors
@ 2022-01-05 13:19 Pavel Skripkin
  2022-01-05 14:15 ` Oleksij Rempel
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Pavel Skripkin @ 2022-01-05 13:19 UTC (permalink / raw)
  To: davem, kuba, linux, andrew, oneukum, robert.foss, freddy
  Cc: linux-usb, netdev, linux-kernel, Pavel Skripkin,
	syzbot+6ca9f7867b77c2d316ac

Syzbot once again hit uninit value in asix driver. The problem still the
same -- asix_read_cmd() reads less bytes, than was requested by caller.

Since all read requests are performed via asix_read_cmd() let's catch
usb related error there and add __must_check notation to be sure all
callers actually check return value.

So, this patch adds sanity check inside asix_read_cmd(), that simply
checks if bytes read are not less, than was requested and adds missing
error handling of asix_read_cmd() all across the driver code.

Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 drivers/net/usb/asix.h         |  4 ++--
 drivers/net/usb/asix_common.c  | 19 +++++++++++++------
 drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++---
 3 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h
index 2a1e31defe71..4334aafab59a 100644
--- a/drivers/net/usb/asix.h
+++ b/drivers/net/usb/asix.h
@@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;
 /* ASIX specific flags */
 #define FLAG_EEPROM_MAC		(1UL << 0)  /* init device MAC from eeprom */
 
-int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
-		  u16 size, void *data, int in_pm);
+int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+			       u16 size, void *data, int in_pm);
 
 int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
 		   u16 size, void *data, int in_pm);
diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 71682970be58..524805285019 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -11,8 +11,8 @@
 
 #define AX_HOST_EN_RETRIES	30
 
-int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
-		  u16 size, void *data, int in_pm)
+int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+			       u16 size, void *data, int in_pm)
 {
 	int ret;
 	int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16);
@@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
 	ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 		 value, index, data, size);
 
-	if (unlikely(ret < 0))
+	if (unlikely(ret < size)) {
+		ret = ret < 0 ? ret : -ENODATA;
+
 		netdev_warn(dev->net, "Failed to read reg index 0x%04x: %d\n",
 			    index, ret);
+	}
 
 	return ret;
 }
@@ -79,7 +82,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm)
 				    0, 0, 1, &smsr, in_pm);
 		if (ret == -ENODEV)
 			break;
-		else if (ret < sizeof(smsr))
+		else if (ret < 0)
 			continue;
 		else if (smsr & AX_HOST_EN)
 			break;
@@ -579,8 +582,12 @@ int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)
 		return ret;
 	}
 
-	asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
-		      (__u16)loc, 2, &res, 1);
+	ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
+			    (__u16)loc, 2, &res, 1);
+	if (ret < 0) {
+		mutex_unlock(&dev->phy_mutex);
+		return ret;
+	}
 	asix_set_hw_mii(dev, 1);
 	mutex_unlock(&dev->phy_mutex);
 
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 4514d35ef4c4..6b2fbdf4e0fd 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -755,7 +755,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 	priv->phy_addr = ret;
 	priv->embd_phy = ((priv->phy_addr & 0x1f) == 0x10);
 
-	asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
+	ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
+	if (ret < 0) {
+		netdev_dbg(dev->net, "Failed to read STATMNGSTS_REG: %d\n", ret);
+		return ret;
+	}
+
 	chipcode &= AX_CHIPCODE_MASK;
 
 	ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
@@ -920,11 +925,21 @@ static int ax88178_reset(struct usbnet *dev)
 	int gpio0 = 0;
 	u32 phyid;
 
-	asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
+	ret = asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
+	if (ret < 0) {
+		netdev_dbg(dev->net, "Failed to read GPIOS: %d\n", ret);
+		return ret;
+	}
+
 	netdev_dbg(dev->net, "GPIO Status: 0x%04x\n", status);
 
 	asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL, 0);
-	asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
+	ret = asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
+	if (ret < 0) {
+		netdev_dbg(dev->net, "Failed to read EEPROM: %d\n", ret);
+		return ret;
+	}
+
 	asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL, 0);
 
 	netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH RFT] net: asix: add proper error handling of usb read errors
  2022-01-05 13:19 [PATCH RFT] net: asix: add proper error handling of usb read errors Pavel Skripkin
@ 2022-01-05 14:15 ` Oleksij Rempel
  2022-01-17 19:31 ` Pavel Skripkin
  2022-02-06 17:23 ` Pavel Skripkin
  2 siblings, 0 replies; 10+ messages in thread
From: Oleksij Rempel @ 2022-01-05 14:15 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: davem, kuba, linux, andrew, oneukum, robert.foss, freddy,
	linux-usb, netdev, linux-kernel, syzbot+6ca9f7867b77c2d316ac

On Wed, Jan 05, 2022 at 04:19:52PM +0300, Pavel Skripkin wrote:
> Syzbot once again hit uninit value in asix driver. The problem still the
> same -- asix_read_cmd() reads less bytes, than was requested by caller.
> 
> Since all read requests are performed via asix_read_cmd() let's catch
> usb related error there and add __must_check notation to be sure all
> callers actually check return value.
> 
> So, this patch adds sanity check inside asix_read_cmd(), that simply
> checks if bytes read are not less, than was requested and adds missing
> error handling of asix_read_cmd() all across the driver code.
> 
> Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
> Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>

Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>

Thank you!

> ---
>  drivers/net/usb/asix.h         |  4 ++--
>  drivers/net/usb/asix_common.c  | 19 +++++++++++++------
>  drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++---
>  3 files changed, 33 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h
> index 2a1e31defe71..4334aafab59a 100644
> --- a/drivers/net/usb/asix.h
> +++ b/drivers/net/usb/asix.h
> @@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;
>  /* ASIX specific flags */
>  #define FLAG_EEPROM_MAC		(1UL << 0)  /* init device MAC from eeprom */
>  
> -int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> -		  u16 size, void *data, int in_pm);
> +int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> +			       u16 size, void *data, int in_pm);
>  
>  int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
>  		   u16 size, void *data, int in_pm);
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index 71682970be58..524805285019 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -11,8 +11,8 @@
>  
>  #define AX_HOST_EN_RETRIES	30
>  
> -int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> -		  u16 size, void *data, int in_pm)
> +int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> +			       u16 size, void *data, int in_pm)
>  {
>  	int ret;
>  	int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16);
> @@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
>  	ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
>  		 value, index, data, size);
>  
> -	if (unlikely(ret < 0))
> +	if (unlikely(ret < size)) {
> +		ret = ret < 0 ? ret : -ENODATA;
> +
>  		netdev_warn(dev->net, "Failed to read reg index 0x%04x: %d\n",
>  			    index, ret);
> +	}
>  
>  	return ret;
>  }
> @@ -79,7 +82,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm)
>  				    0, 0, 1, &smsr, in_pm);
>  		if (ret == -ENODEV)
>  			break;
> -		else if (ret < sizeof(smsr))
> +		else if (ret < 0)
>  			continue;
>  		else if (smsr & AX_HOST_EN)
>  			break;
> @@ -579,8 +582,12 @@ int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)
>  		return ret;
>  	}
>  
> -	asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
> -		      (__u16)loc, 2, &res, 1);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
> +			    (__u16)loc, 2, &res, 1);
> +	if (ret < 0) {
> +		mutex_unlock(&dev->phy_mutex);
> +		return ret;
> +	}
>  	asix_set_hw_mii(dev, 1);
>  	mutex_unlock(&dev->phy_mutex);
>  
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index 4514d35ef4c4..6b2fbdf4e0fd 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -755,7 +755,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>  	priv->phy_addr = ret;
>  	priv->embd_phy = ((priv->phy_addr & 0x1f) == 0x10);
>  
> -	asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read STATMNGSTS_REG: %d\n", ret);
> +		return ret;
> +	}
> +
>  	chipcode &= AX_CHIPCODE_MASK;
>  
>  	ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
> @@ -920,11 +925,21 @@ static int ax88178_reset(struct usbnet *dev)
>  	int gpio0 = 0;
>  	u32 phyid;
>  
> -	asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read GPIOS: %d\n", ret);
> +		return ret;
> +	}
> +
>  	netdev_dbg(dev->net, "GPIO Status: 0x%04x\n", status);
>  
>  	asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL, 0);
> -	asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read EEPROM: %d\n", ret);
> +		return ret;
> +	}
> +
>  	asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL, 0);
>  
>  	netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom);
> -- 
> 2.34.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RFT] net: asix: add proper error handling of usb read errors
  2022-01-05 13:19 [PATCH RFT] net: asix: add proper error handling of usb read errors Pavel Skripkin
  2022-01-05 14:15 ` Oleksij Rempel
@ 2022-01-17 19:31 ` Pavel Skripkin
  2022-01-18  6:18   ` Greg KH
  2022-02-06 17:23 ` Pavel Skripkin
  2 siblings, 1 reply; 10+ messages in thread
From: Pavel Skripkin @ 2022-01-17 19:31 UTC (permalink / raw)
  To: davem, kuba, linux, andrew, oneukum, robert.foss, freddy
  Cc: linux-usb, netdev, linux-kernel, syzbot+6ca9f7867b77c2d316ac

On 1/5/22 16:19, Pavel Skripkin wrote:
> Syzbot once again hit uninit value in asix driver. The problem still the
> same -- asix_read_cmd() reads less bytes, than was requested by caller.
> 
> Since all read requests are performed via asix_read_cmd() let's catch
> usb related error there and add __must_check notation to be sure all
> callers actually check return value.
> 
> So, this patch adds sanity check inside asix_read_cmd(), that simply
> checks if bytes read are not less, than was requested and adds missing
> error handling of asix_read_cmd() all across the driver code.
> 
> Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
> Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---

gentle ping :)

>   drivers/net/usb/asix.h         |  4 ++--
>   drivers/net/usb/asix_common.c  | 19 +++++++++++++------
>   drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++---
>   3 files changed, 33 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h
> index 2a1e31defe71..4334aafab59a 100644
> --- a/drivers/net/usb/asix.h
> +++ b/drivers/net/usb/asix.h
> @@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;
>   /* ASIX specific flags */
>   #define FLAG_EEPROM_MAC		(1UL << 0)  /* init device MAC from eeprom */
>   
> -int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> -		  u16 size, void *data, int in_pm);
> +int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> +			       u16 size, void *data, int in_pm);
>   
>   int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
>   		   u16 size, void *data, int in_pm);
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index 71682970be58..524805285019 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -11,8 +11,8 @@
>   
>   #define AX_HOST_EN_RETRIES	30
>   
> -int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> -		  u16 size, void *data, int in_pm)
> +int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> +			       u16 size, void *data, int in_pm)
>   {
>   	int ret;
>   	int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16);
> @@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
>   	ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
>   		 value, index, data, size);
>   
> -	if (unlikely(ret < 0))
> +	if (unlikely(ret < size)) {
> +		ret = ret < 0 ? ret : -ENODATA;
> +
>   		netdev_warn(dev->net, "Failed to read reg index 0x%04x: %d\n",
>   			    index, ret);
> +	}
>   
>   	return ret;
>   }
> @@ -79,7 +82,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm)
>   				    0, 0, 1, &smsr, in_pm);
>   		if (ret == -ENODEV)
>   			break;
> -		else if (ret < sizeof(smsr))
> +		else if (ret < 0)
>   			continue;
>   		else if (smsr & AX_HOST_EN)
>   			break;
> @@ -579,8 +582,12 @@ int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)
>   		return ret;
>   	}
>   
> -	asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
> -		      (__u16)loc, 2, &res, 1);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
> +			    (__u16)loc, 2, &res, 1);
> +	if (ret < 0) {
> +		mutex_unlock(&dev->phy_mutex);
> +		return ret;
> +	}
>   	asix_set_hw_mii(dev, 1);
>   	mutex_unlock(&dev->phy_mutex);
>   
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index 4514d35ef4c4..6b2fbdf4e0fd 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -755,7 +755,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>   	priv->phy_addr = ret;
>   	priv->embd_phy = ((priv->phy_addr & 0x1f) == 0x10);
>   
> -	asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read STATMNGSTS_REG: %d\n", ret);
> +		return ret;
> +	}
> +
>   	chipcode &= AX_CHIPCODE_MASK;
>   
>   	ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
> @@ -920,11 +925,21 @@ static int ax88178_reset(struct usbnet *dev)
>   	int gpio0 = 0;
>   	u32 phyid;
>   
> -	asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read GPIOS: %d\n", ret);
> +		return ret;
> +	}
> +
>   	netdev_dbg(dev->net, "GPIO Status: 0x%04x\n", status);
>   
>   	asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL, 0);
> -	asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read EEPROM: %d\n", ret);
> +		return ret;
> +	}
> +
>   	asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL, 0);
>   
>   	netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom);




With regards,
Pavel Skripkin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RFT] net: asix: add proper error handling of usb read errors
  2022-01-17 19:31 ` Pavel Skripkin
@ 2022-01-18  6:18   ` Greg KH
  2022-01-18 19:00     ` Pavel Skripkin
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2022-01-18  6:18 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: davem, kuba, linux, andrew, oneukum, robert.foss, freddy,
	linux-usb, netdev, linux-kernel, syzbot+6ca9f7867b77c2d316ac

On Mon, Jan 17, 2022 at 10:31:21PM +0300, Pavel Skripkin wrote:
> On 1/5/22 16:19, Pavel Skripkin wrote:
> > Syzbot once again hit uninit value in asix driver. The problem still the
> > same -- asix_read_cmd() reads less bytes, than was requested by caller.
> > 
> > Since all read requests are performed via asix_read_cmd() let's catch
> > usb related error there and add __must_check notation to be sure all
> > callers actually check return value.
> > 
> > So, this patch adds sanity check inside asix_read_cmd(), that simply
> > checks if bytes read are not less, than was requested and adds missing
> > error handling of asix_read_cmd() all across the driver code.
> > 
> > Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
> > Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
> > Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> > ---
> 
> gentle ping :)

It's the middle of a merge window, and you ask for testing before it can
be applied?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RFT] net: asix: add proper error handling of usb read errors
  2022-01-18  6:18   ` Greg KH
@ 2022-01-18 19:00     ` Pavel Skripkin
  0 siblings, 0 replies; 10+ messages in thread
From: Pavel Skripkin @ 2022-01-18 19:00 UTC (permalink / raw)
  To: Greg KH
  Cc: davem, kuba, linux, andrew, oneukum, robert.foss, freddy,
	linux-usb, netdev, linux-kernel, syzbot+6ca9f7867b77c2d316ac

Hi Greg,

On 1/18/22 09:18, Greg KH wrote:
> On Mon, Jan 17, 2022 at 10:31:21PM +0300, Pavel Skripkin wrote:
>> On 1/5/22 16:19, Pavel Skripkin wrote:
>> > Syzbot once again hit uninit value in asix driver. The problem still the
>> > same -- asix_read_cmd() reads less bytes, than was requested by caller.
>> > 
>> > Since all read requests are performed via asix_read_cmd() let's catch
>> > usb related error there and add __must_check notation to be sure all
>> > callers actually check return value.
>> > 
>> > So, this patch adds sanity check inside asix_read_cmd(), that simply
>> > checks if bytes read are not less, than was requested and adds missing
>> > error handling of asix_read_cmd() all across the driver code.
>> > 
>> > Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
>> > Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
>> > Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
>> > ---
>> 
>> gentle ping :)
> 
> It's the middle of a merge window, and you ask for testing before it can
> be applied?
> 

I indeed lost track of days, sorry for bothering during merge window, my 
bad.

FYI, this patch was tested by Oleksij [1], that why I decided to ping, 
but as I said I lost track of days a bit

[1] https://lore.kernel.org/all/20220105141535.GI303@pengutronix.de/


With regards,
Pavel Skripkin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RFT] net: asix: add proper error handling of usb read errors
  2022-01-05 13:19 [PATCH RFT] net: asix: add proper error handling of usb read errors Pavel Skripkin
  2022-01-05 14:15 ` Oleksij Rempel
  2022-01-17 19:31 ` Pavel Skripkin
@ 2022-02-06 17:23 ` Pavel Skripkin
  2022-02-06 17:48   ` Oleksij Rempel
  2 siblings, 1 reply; 10+ messages in thread
From: Pavel Skripkin @ 2022-02-06 17:23 UTC (permalink / raw)
  To: davem, kuba, linux, andrew, oneukum, robert.foss, freddy
  Cc: linux-usb, netdev, linux-kernel, syzbot+6ca9f7867b77c2d316ac

On 1/5/22 16:19, Pavel Skripkin wrote:
> Syzbot once again hit uninit value in asix driver. The problem still the
> same -- asix_read_cmd() reads less bytes, than was requested by caller.
> 
> Since all read requests are performed via asix_read_cmd() let's catch
> usb related error there and add __must_check notation to be sure all
> callers actually check return value.
> 
> So, this patch adds sanity check inside asix_read_cmd(), that simply
> checks if bytes read are not less, than was requested and adds missing
> error handling of asix_read_cmd() all across the driver code.
> 
> Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
> Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---

gentle ping :)

>   drivers/net/usb/asix.h         |  4 ++--
>   drivers/net/usb/asix_common.c  | 19 +++++++++++++------
>   drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++---
>   3 files changed, 33 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h
> index 2a1e31defe71..4334aafab59a 100644
> --- a/drivers/net/usb/asix.h
> +++ b/drivers/net/usb/asix.h
> @@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;
>   /* ASIX specific flags */
>   #define FLAG_EEPROM_MAC		(1UL << 0)  /* init device MAC from eeprom */
>   
> -int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> -		  u16 size, void *data, int in_pm);
> +int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> +			       u16 size, void *data, int in_pm);
>   
>   int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
>   		   u16 size, void *data, int in_pm);
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index 71682970be58..524805285019 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -11,8 +11,8 @@
>   
>   #define AX_HOST_EN_RETRIES	30
>   
> -int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> -		  u16 size, void *data, int in_pm)
> +int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> +			       u16 size, void *data, int in_pm)
>   {
>   	int ret;
>   	int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16);
> @@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
>   	ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
>   		 value, index, data, size);
>   
> -	if (unlikely(ret < 0))
> +	if (unlikely(ret < size)) {
> +		ret = ret < 0 ? ret : -ENODATA;
> +
>   		netdev_warn(dev->net, "Failed to read reg index 0x%04x: %d\n",
>   			    index, ret);
> +	}
>   
>   	return ret;
>   }
> @@ -79,7 +82,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm)
>   				    0, 0, 1, &smsr, in_pm);
>   		if (ret == -ENODEV)
>   			break;
> -		else if (ret < sizeof(smsr))
> +		else if (ret < 0)
>   			continue;
>   		else if (smsr & AX_HOST_EN)
>   			break;
> @@ -579,8 +582,12 @@ int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)
>   		return ret;
>   	}
>   
> -	asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
> -		      (__u16)loc, 2, &res, 1);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
> +			    (__u16)loc, 2, &res, 1);
> +	if (ret < 0) {
> +		mutex_unlock(&dev->phy_mutex);
> +		return ret;
> +	}
>   	asix_set_hw_mii(dev, 1);
>   	mutex_unlock(&dev->phy_mutex);
>   
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index 4514d35ef4c4..6b2fbdf4e0fd 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -755,7 +755,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>   	priv->phy_addr = ret;
>   	priv->embd_phy = ((priv->phy_addr & 0x1f) == 0x10);
>   
> -	asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read STATMNGSTS_REG: %d\n", ret);
> +		return ret;
> +	}
> +
>   	chipcode &= AX_CHIPCODE_MASK;
>   
>   	ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
> @@ -920,11 +925,21 @@ static int ax88178_reset(struct usbnet *dev)
>   	int gpio0 = 0;
>   	u32 phyid;
>   
> -	asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read GPIOS: %d\n", ret);
> +		return ret;
> +	}
> +
>   	netdev_dbg(dev->net, "GPIO Status: 0x%04x\n", status);
>   
>   	asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL, 0);
> -	asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
> +	ret = asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
> +	if (ret < 0) {
> +		netdev_dbg(dev->net, "Failed to read EEPROM: %d\n", ret);
> +		return ret;
> +	}
> +
>   	asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL, 0);
>   
>   	netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom);




With regards,
Pavel Skripkin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RFT] net: asix: add proper error handling of usb read errors
  2022-02-06 17:23 ` Pavel Skripkin
@ 2022-02-06 17:48   ` Oleksij Rempel
  2022-02-06 18:05     ` [PATCH net-next] " Pavel Skripkin
  0 siblings, 1 reply; 10+ messages in thread
From: Oleksij Rempel @ 2022-02-06 17:48 UTC (permalink / raw)
  To: Pavel Skripkin, davem, kuba, andrew, oneukum, robert.foss, freddy
  Cc: linux-usb, netdev, linux-kernel, syzbot+6ca9f7867b77c2d316ac

Am 06.02.22 um 18:23 schrieb Pavel Skripkin:
> On 1/5/22 16:19, Pavel Skripkin wrote:
>> Syzbot once again hit uninit value in asix driver. The problem still the
>> same -- asix_read_cmd() reads less bytes, than was requested by caller.
>>
>> Since all read requests are performed via asix_read_cmd() let's catch
>> usb related error there and add __must_check notation to be sure all
>> callers actually check return value.
>>
>> So, this patch adds sanity check inside asix_read_cmd(), that simply
>> checks if bytes read are not less, than was requested and adds missing
>> error handling of asix_read_cmd() all across the driver code.
>>
>> Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
>> Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
>> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
>> ---
>
> gentle ping :)

Please resend patch against latest net-next with "net-next" tag instead of "RFT".

--
Regards,
Oleksij

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net-next] net: asix: add proper error handling of usb read errors
  2022-02-06 17:48   ` Oleksij Rempel
@ 2022-02-06 18:05     ` Pavel Skripkin
  2022-02-07 10:27       ` Greg KH
  2022-02-07 12:30       ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 10+ messages in thread
From: Pavel Skripkin @ 2022-02-06 18:05 UTC (permalink / raw)
  To: davem, kuba, linux, andrew, oneukum, robert.foss
  Cc: linux-usb, netdev, linux-kernel, Pavel Skripkin,
	syzbot+6ca9f7867b77c2d316ac, Oleksij Rempel

Syzbot once again hit uninit value in asix driver. The problem still the
same -- asix_read_cmd() reads less bytes, than was requested by caller.

Since all read requests are performed via asix_read_cmd() let's catch
usb related error there and add __must_check notation to be sure all
callers actually check return value.

So, this patch adds sanity check inside asix_read_cmd(), that simply
checks if bytes read are not less, than was requested and adds missing
error handling of asix_read_cmd() all across the driver code.

Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
---

Changes since RFT:
	- Added Tested-by: tag

---
 drivers/net/usb/asix.h         |  4 ++--
 drivers/net/usb/asix_common.c  | 19 +++++++++++++------
 drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++---
 3 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h
index 2a1e31def..4334aafab 100644
--- a/drivers/net/usb/asix.h
+++ b/drivers/net/usb/asix.h
@@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;
 /* ASIX specific flags */
 #define FLAG_EEPROM_MAC		(1UL << 0)  /* init device MAC from eeprom */
 
-int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
-		  u16 size, void *data, int in_pm);
+int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+			       u16 size, void *data, int in_pm);
 
 int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
 		   u16 size, void *data, int in_pm);
diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 71682970b..524805285 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -11,8 +11,8 @@
 
 #define AX_HOST_EN_RETRIES	30
 
-int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
-		  u16 size, void *data, int in_pm)
+int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+			       u16 size, void *data, int in_pm)
 {
 	int ret;
 	int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16);
@@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
 	ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 		 value, index, data, size);
 
-	if (unlikely(ret < 0))
+	if (unlikely(ret < size)) {
+		ret = ret < 0 ? ret : -ENODATA;
+
 		netdev_warn(dev->net, "Failed to read reg index 0x%04x: %d\n",
 			    index, ret);
+	}
 
 	return ret;
 }
@@ -79,7 +82,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm)
 				    0, 0, 1, &smsr, in_pm);
 		if (ret == -ENODEV)
 			break;
-		else if (ret < sizeof(smsr))
+		else if (ret < 0)
 			continue;
 		else if (smsr & AX_HOST_EN)
 			break;
@@ -579,8 +582,12 @@ int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)
 		return ret;
 	}
 
-	asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
-		      (__u16)loc, 2, &res, 1);
+	ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
+			    (__u16)loc, 2, &res, 1);
+	if (ret < 0) {
+		mutex_unlock(&dev->phy_mutex);
+		return ret;
+	}
 	asix_set_hw_mii(dev, 1);
 	mutex_unlock(&dev->phy_mutex);
 
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 9b72334aa..6ea44e537 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -755,7 +755,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 	priv->phy_addr = ret;
 	priv->embd_phy = ((priv->phy_addr & 0x1f) == 0x10);
 
-	asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
+	ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
+	if (ret < 0) {
+		netdev_dbg(dev->net, "Failed to read STATMNGSTS_REG: %d\n", ret);
+		return ret;
+	}
+
 	chipcode &= AX_CHIPCODE_MASK;
 
 	ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
@@ -919,11 +924,21 @@ static int ax88178_reset(struct usbnet *dev)
 	int gpio0 = 0;
 	u32 phyid;
 
-	asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
+	ret = asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status, 0);
+	if (ret < 0) {
+		netdev_dbg(dev->net, "Failed to read GPIOS: %d\n", ret);
+		return ret;
+	}
+
 	netdev_dbg(dev->net, "GPIO Status: 0x%04x\n", status);
 
 	asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL, 0);
-	asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
+	ret = asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom, 0);
+	if (ret < 0) {
+		netdev_dbg(dev->net, "Failed to read EEPROM: %d\n", ret);
+		return ret;
+	}
+
 	asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL, 0);
 
 	netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next] net: asix: add proper error handling of usb read errors
  2022-02-06 18:05     ` [PATCH net-next] " Pavel Skripkin
@ 2022-02-07 10:27       ` Greg KH
  2022-02-07 12:30       ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 10+ messages in thread
From: Greg KH @ 2022-02-07 10:27 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: davem, kuba, linux, andrew, oneukum, robert.foss, linux-usb,
	netdev, linux-kernel, syzbot+6ca9f7867b77c2d316ac,
	Oleksij Rempel

On Sun, Feb 06, 2022 at 09:05:16PM +0300, Pavel Skripkin wrote:
> Syzbot once again hit uninit value in asix driver. The problem still the
> same -- asix_read_cmd() reads less bytes, than was requested by caller.
> 
> Since all read requests are performed via asix_read_cmd() let's catch
> usb related error there and add __must_check notation to be sure all
> callers actually check return value.
> 
> So, this patch adds sanity check inside asix_read_cmd(), that simply
> checks if bytes read are not less, than was requested and adds missing
> error handling of asix_read_cmd() all across the driver code.
> 
> Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
> Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> 
> Changes since RFT:
> 	- Added Tested-by: tag
> 
> ---
>  drivers/net/usb/asix.h         |  4 ++--
>  drivers/net/usb/asix_common.c  | 19 +++++++++++++------
>  drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++---
>  3 files changed, 33 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h
> index 2a1e31def..4334aafab 100644
> --- a/drivers/net/usb/asix.h
> +++ b/drivers/net/usb/asix.h
> @@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;
>  /* ASIX specific flags */
>  #define FLAG_EEPROM_MAC		(1UL << 0)  /* init device MAC from eeprom */
>  
> -int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> -		  u16 size, void *data, int in_pm);
> +int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> +			       u16 size, void *data, int in_pm);
>  
>  int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
>  		   u16 size, void *data, int in_pm);
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index 71682970b..524805285 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -11,8 +11,8 @@
>  
>  #define AX_HOST_EN_RETRIES	30
>  
> -int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> -		  u16 size, void *data, int in_pm)
> +int __must_check asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
> +			       u16 size, void *data, int in_pm)
>  {
>  	int ret;
>  	int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16);
> @@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
>  	ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
>  		 value, index, data, size);
>  
> -	if (unlikely(ret < 0))
> +	if (unlikely(ret < size)) {
> +		ret = ret < 0 ? ret : -ENODATA;
> +

Didn't I suggest using the proper USB core functions for this instead of
rolling your own functions?  We now have usb_control_msg_read() and
usb_control_msg_send() that prevents this type of thing from happening.

Ah, it's a bit more tangled up than that it seems, the number of layers
of abstractions here is odd and deep.  This change looks fine for now to
keep syzbot happy:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next] net: asix: add proper error handling of usb read errors
  2022-02-06 18:05     ` [PATCH net-next] " Pavel Skripkin
  2022-02-07 10:27       ` Greg KH
@ 2022-02-07 12:30       ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-07 12:30 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: davem, kuba, linux, andrew, oneukum, robert.foss, linux-usb,
	netdev, linux-kernel, syzbot+6ca9f7867b77c2d316ac, o.rempel

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Sun,  6 Feb 2022 21:05:16 +0300 you wrote:
> Syzbot once again hit uninit value in asix driver. The problem still the
> same -- asix_read_cmd() reads less bytes, than was requested by caller.
> 
> Since all read requests are performed via asix_read_cmd() let's catch
> usb related error there and add __must_check notation to be sure all
> callers actually check return value.
> 
> [...]

Here is the summary with links:
  - [net-next] net: asix: add proper error handling of usb read errors
    https://git.kernel.org/netdev/net-next/c/920a9fa27e78

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-02-07 12:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 13:19 [PATCH RFT] net: asix: add proper error handling of usb read errors Pavel Skripkin
2022-01-05 14:15 ` Oleksij Rempel
2022-01-17 19:31 ` Pavel Skripkin
2022-01-18  6:18   ` Greg KH
2022-01-18 19:00     ` Pavel Skripkin
2022-02-06 17:23 ` Pavel Skripkin
2022-02-06 17:48   ` Oleksij Rempel
2022-02-06 18:05     ` [PATCH net-next] " Pavel Skripkin
2022-02-07 10:27       ` Greg KH
2022-02-07 12:30       ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).