ray_cs: Check return value of pcmcia_register_driver
diff mbox series

Message ID 20190306114614.19116-1-yuehaibing@huawei.com
State Accepted
Commit 444efbde32816a950c1749582f2e9241e3d5ee80
Delegated to: Kalle Valo
Headers show
Series
  • ray_cs: Check return value of pcmcia_register_driver
Related show

Commit Message

YueHaibing March 6, 2019, 11:46 a.m. UTC
From: YueHaibing <yuehaibing@huawei.com>

init_ray_cs does not check value of pcmcia_register_driver,
if it fails, there maybe cause a NULL pointer dereference in
exit_ray_cs.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/wireless/ray_cs.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kalle Valo April 25, 2019, 4:38 p.m. UTC | #1
Yue Haibing <yuehaibing@huawei.com> wrote:

> From: YueHaibing <yuehaibing@huawei.com>
> 
> init_ray_cs does not check value of pcmcia_register_driver,
> if it fails, there maybe cause a NULL pointer dereference in
> exit_ray_cs.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Patch applied to wireless-drivers-next.git, thanks.

444efbde3281 ray_cs: Check return value of pcmcia_register_driver

Patch
diff mbox series

diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 44a943d..d561659 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -2795,6 +2795,8 @@  static int __init init_ray_cs(void)
 	rc = pcmcia_register_driver(&ray_driver);
 	pr_debug("raylink init_module register_pcmcia_driver returns 0x%x\n",
 	      rc);
+	if (rc)
+		return rc;
 
 #ifdef CONFIG_PROC_FS
 	proc_mkdir("driver/ray_cs", NULL);