| From 4ad7fab6d27a5f71583230ff006648442a2c44a3 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Sun, 15 Dec 2019 13:58:58 -0600 |
| Subject: orinoco: avoid assertion in case of NULL pointer |
| |
| From: Aditya Pakki <pakki001@umn.edu> |
| |
| [ Upstream commit c705f9fc6a1736dcf6ec01f8206707c108dca824 ] |
| |
| In ezusb_init, if upriv is NULL, the code crashes. However, the caller |
| in ezusb_probe can handle the error and print the failure message. |
| The patch replaces the BUG_ON call to error return. |
| |
| Signed-off-by: Aditya Pakki <pakki001@umn.edu> |
| Signed-off-by: Kalle Valo <kvalo@codeaurora.org> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 3 ++- |
| 1 file changed, 2 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
| index 2c7dd2a7350c1..b704e4bce171d 100644 |
| --- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
| +++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
| @@ -1364,7 +1364,8 @@ static int ezusb_init(struct hermes *hw) |
| int retval; |
| |
| BUG_ON(in_interrupt()); |
| - BUG_ON(!upriv); |
| + if (!upriv) |
| + return -EINVAL; |
| |
| upriv->reply_count = 0; |
| /* Write the MAGIC number on the simulated registers to keep |
| -- |
| 2.20.1 |
| |