提交 48de1a17 编写于 作者: L Larry Finger 提交者: John W. Linville

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: NLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 3abead59
...@@ -346,9 +346,14 @@ static int _rtl_usb_init(struct ieee80211_hw *hw) ...@@ -346,9 +346,14 @@ static int _rtl_usb_init(struct ieee80211_hw *hw)
pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize,
pep_desc->bInterval); pep_desc->bInterval);
} }
if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num) if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num) {
return -EINVAL ; pr_err("Too few input end points found\n");
return -EINVAL;
}
if (rtlusb->out_ep_nums == 0) {
pr_err("No output end points found\n");
return -EINVAL;
}
/* usb endpoint mapping */ /* usb endpoint mapping */
err = rtlpriv->cfg->usb_interface_cfg->usb_endpoint_mapping(hw); err = rtlpriv->cfg->usb_interface_cfg->usb_endpoint_mapping(hw);
rtlusb->usb_mq_to_hwq = rtlpriv->cfg->usb_interface_cfg->usb_mq_to_hwq; 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,6 +981,8 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
} }
rtlpriv->cfg->ops->init_sw_leds(hw); rtlpriv->cfg->ops->init_sw_leds(hw);
err = _rtl_usb_init(hw); err = _rtl_usb_init(hw);
if (err)
goto error_out;
err = _rtl_usb_init_sw(hw); err = _rtl_usb_init_sw(hw);
/* Init mac80211 sw */ /* Init mac80211 sw */
err = rtl_init_core(hw); err = rtl_init_core(hw);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册