From: a17671 Date: Fri, 8 Nov 2019 02:48:21 +0000 (+0800) Subject: usb:Balance the enable/disable in secure mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=18a3b1021c790bbeb8e83c764268becb2eb149de;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git usb:Balance the enable/disable in secure mode Enable/Disable shall be banlanced when USB in secure mode Otherwise the linked_func and func_list could be messed up That will cause the unbinding release the wild memory This is a Samsung platform only issue,kernel panic Has the following mark: configfs-gadget gadget:unbind function 'mtp' configfs-gadget gadget:unbind function 'ptp' Which shall not happen, since user could not choose Both mtp and ptp together Change-Id: I4aba691a0c4180f828c55aad5d63b9162c3f881a Signed-off-by: a17671 Reviewed-on: https://gerrit.mot.com/1451197 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 8dd6ea47a6de..3d2e8fca5145 100755 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -1776,6 +1776,7 @@ static ssize_t enable_store(struct device *pdev, struct device_attribute *attr, #else cdev->next_string_id = 0; #endif + if (!dev->secure) { if (!gadget) { pr_info("%s: Gadget is NULL: %p\n", __func__, gadget); mutex_unlock(&dev->lock); @@ -1783,6 +1784,7 @@ static ssize_t enable_store(struct device *pdev, struct device_attribute *attr, } usb_gadget_connect(gadget); + } dev->enabled = true; #ifdef CONFIG_USB_TYPEC_MANAGER_NOTIFIER set_usb_enable_state();