diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2012-03-02 14:21:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-05 15:53:47 -0500 |
commit | 48de1a17fc41613b7e9d61037fa989256d04234f (patch) | |
tree | ae7aa10257c863880a932d78f2b7231f9404ea3d /drivers/net/wireless/rtlwifi | |
parent | 3abead59fcdeb56df8b83288a2f5edbe6423b0bb (diff) |
rtlwifi: Detect misread of end-point count
In the unlikely event of a misread of the USB end point count, the driver
generates a divide fault. To prevent this, add a check of the value
returned by _rtl_usb_init(). In addition, add some logging to indicate
why the condition occurred.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r-- | drivers/net/wireless/rtlwifi/usb.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index ffcf89fe45e4..b0eee0eb5679 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -346,9 +346,14 @@ static int _rtl_usb_init(struct ieee80211_hw *hw) | |||
346 | pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, | 346 | pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, |
347 | pep_desc->bInterval); | 347 | pep_desc->bInterval); |
348 | } | 348 | } |
349 | if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num) | 349 | if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num) { |
350 | return -EINVAL ; | 350 | pr_err("Too few input end points found\n"); |
351 | 351 | return -EINVAL; | |
352 | } | ||
353 | if (rtlusb->out_ep_nums == 0) { | ||
354 | pr_err("No output end points found\n"); | ||
355 | return -EINVAL; | ||
356 | } | ||
352 | /* usb endpoint mapping */ | 357 | /* usb endpoint mapping */ |
353 | err = rtlpriv->cfg->usb_interface_cfg->usb_endpoint_mapping(hw); | 358 | err = rtlpriv->cfg->usb_interface_cfg->usb_endpoint_mapping(hw); |
354 | rtlusb->usb_mq_to_hwq = rtlpriv->cfg->usb_interface_cfg->usb_mq_to_hwq; | 359 | rtlusb->usb_mq_to_hwq = rtlpriv->cfg->usb_interface_cfg->usb_mq_to_hwq; |
@@ -976,6 +981,8 @@ int __devinit rtl_usb_probe(struct usb_interface *intf, | |||
976 | } | 981 | } |
977 | rtlpriv->cfg->ops->init_sw_leds(hw); | 982 | rtlpriv->cfg->ops->init_sw_leds(hw); |
978 | err = _rtl_usb_init(hw); | 983 | err = _rtl_usb_init(hw); |
984 | if (err) | ||
985 | goto error_out; | ||
979 | err = _rtl_usb_init_sw(hw); | 986 | err = _rtl_usb_init_sw(hw); |
980 | /* Init mac80211 sw */ | 987 | /* Init mac80211 sw */ |
981 | err = rtl_init_core(hw); | 988 | err = rtl_init_core(hw); |