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

Commit 8ca4a3e9 authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian
Browse files

msm-core: Unregister uio device on failed probe



In certain error scenarios, the probe function returns error code without
actually freesing the uio device. This could result in a panic when
userspace accesses the uio device.

Fix by freeing the uio device on faileed probe.

Change-Id: I20af803a10407206759d3aeeac5bf59f674b3d04
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent 41747adc
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1016,6 +1016,7 @@ static int msm_core_dev_probe(struct platform_device *pdev)
	char *key = NULL;
	struct device_node *node;
	int cpu;
	struct uio_info *info;

	if (!pdev)
		return -ENODEV;
@@ -1049,12 +1050,12 @@ static int msm_core_dev_probe(struct platform_device *pdev)

	ret = msm_core_freq_init();
	if (ret)
		return ret;
		goto failed;

	ret = misc_register(&msm_core_device);
	if (ret) {
		pr_err("%s: Error registering device %d\n", __func__, ret);
		return ret;
		goto failed;
	}

	ret = msm_core_params_init(pdev);
@@ -1074,6 +1075,8 @@ static int msm_core_dev_probe(struct platform_device *pdev)
	pm_notifier(system_suspend_handler, 0);
	return 0;
failed:
	info = dev_get_drvdata(&pdev->dev);
	uio_unregister_device(info);
	free_dyn_memory();
	return ret;
}