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

Commit ec9eeeda authored by ramandeep trehan's avatar ramandeep trehan
Browse files

crypto: ice: Sanitize the ice device return address.



Even if ICE device is not found it is possible
for list device API to return non NULL pointer
which will pass all NULL checks in code. Ensure
to return proper address or NULL.

Change-Id: Id36bad92fc3c527bdea0b3307210b01cab7197af
Signed-off-by: default avatarramandeep trehan <rtrehan@qti.qualcomm.com>
parent c84700b1
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -833,7 +833,7 @@ static int qcom_ice_restore_config(void)
static int qcom_ice_init_clocks(struct ice_device *ice)
{
	int ret = -EINVAL;
	struct ice_clk_info *clki;
	struct ice_clk_info *clki = NULL;
	struct device *dev = ice->pdev;
	struct list_head *head = &ice->clk_list_head;

@@ -877,7 +877,7 @@ out:
static int qcom_ice_enable_clocks(struct ice_device *ice, bool enable)
{
	int ret = 0;
	struct ice_clk_info *clki;
	struct ice_clk_info *clki = NULL;
	struct device *dev = ice->pdev;
	struct list_head *head = &ice->clk_list_head;

@@ -1530,11 +1530,12 @@ struct platform_device *qcom_ice_get_pdevice(struct device_node *node)
		if (ice_dev->pdev->of_node == node) {
			pr_info("%s: found ice device %pK\n", __func__,
			ice_dev);
			ice_pdev = to_platform_device(ice_dev->pdev);
			break;
		}
	}

	ice_pdev = to_platform_device(ice_dev->pdev);
	if(ice_pdev)
		pr_info("%s: matching platform device %pK\n", __func__, ice_pdev);
out:
	return ice_pdev;
@@ -1554,11 +1555,11 @@ static struct ice_device *get_ice_device_from_storage_type
	list_for_each_entry(ice_dev, &ice_devices, list) {
		if (!strcmp(ice_dev->ice_instance_type, storage_type)) {
			pr_info("%s: found ice device %p\n", __func__, ice_dev);
			break;
			return ice_dev;
		}
	}
out:
	return ice_dev;
	return NULL;
}

static int enable_ice_setup(struct ice_device *ice_dev)