Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d9067a7 authored by Konstantin Dorfman's avatar Konstantin Dorfman
Browse files

soc: qcom: spcom: fix NULL pointer dereference



This change fix kernel panic due to NULL pointer dereference from
spcom_probe while unregister the device. Observed during kernel testing
(bind/unbind of platform driver).

Change-Id: I5ead40d9da25e9ca2a59af9ba8c236d575103eae
Signed-off-by: default avatarKonstantin Dorfman <kdorfman@codeaurora.org>
parent e4fab30e
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -2764,7 +2764,7 @@ static int spcom_probe(struct platform_device *pdev)
	ret = spcom_register_chardev();
	ret = spcom_register_chardev();
	if (ret) {
	if (ret) {
		pr_err("create character device failed.\n");
		pr_err("create character device failed.\n");
		goto fail_reg_chardev;
		goto fail_while_chardev_reg;
	}
	}


	link_info.glink_link_state_notif_cb = spcom_link_state_notif_cb;
	link_info.glink_link_state_notif_cb = spcom_link_state_notif_cb;
@@ -2802,6 +2802,7 @@ static int spcom_probe(struct platform_device *pdev)
fail_reg_chardev:
fail_reg_chardev:
	pr_err("Failed to init driver.\n");
	pr_err("Failed to init driver.\n");
	spcom_unregister_chrdev();
	spcom_unregister_chrdev();
fail_while_chardev_reg:
	kfree(dev);
	kfree(dev);
	spcom_dev = NULL;
	spcom_dev = NULL;