Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp775232pxk; Thu, 17 Sep 2020 16:20:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpaOH9sOCFAG+wcxAHTY1Q2PzVHYmkPzglt3k59kklt+bANzr55vqeZFL//gEtvP3woiY9 X-Received: by 2002:a17:906:1e11:: with SMTP id g17mr31408159ejj.298.1600384822050; Thu, 17 Sep 2020 16:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600384822; cv=none; d=google.com; s=arc-20160816; b=gKJ74jMlzzxp8KIz31PgXKCKNbrt73A2CqviRtVZODPRzjao2L4xEVi+suU4M0LzpX hNliTBQC4bbb5anClcL7KMMJ+LMrdSHVS4fc8ePp7+fK3ZNG7YR7q9bHrGIz+999hbXO jvwGznax0sqxTNZRDf8BZ+MxFJIC/vkuumNcIVDHb9WWbQo6FTp2KgQIMeQYZ8nwaKSH NalcCzC7iyl2y8nOMxAX34dxBf3K6LZEP9lsVuGTi3MIquEQntGMxVA5BoOMmjEwm2zu 1/8sgTau8zPPQKPwBdLrbwJNBGyXUBJMO9EfBkfCqvpIAXZFiSolFtZDHxtOVTe8uSVU hUfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:from:cc:to :dkim-signature; bh=YeOyKeCzbk9VWMgOTxwltUHxECBUKayGqCzk0HAQiXM=; b=hikJ/acqIqKOKI5i38GaEF9G3K/5bnKDMATWNCSK2gFALMRWDRMqD+pqcewYJfKkca CJo0IGD6h3F2bQkZxX5OypdQ2JU53ok7u/mi6O6HdxPjG/hsp26TBdP2YIiSAYBWyyQx Z/3hNHe8555bp8fKlIrN+Ri+BXnQeh6gSdlsS7kxKayNJPyDs8asIkPd/ozLaVCyXA+f l6gxfMZOi/ABRAhcjg99T4/LD8jJFYCkM5PTjtdELRhY3/0bgAtKh5X8IrFpi1HCL+TH c/XLHGnUIb6iWnJ5kuGCDRZtVD3bV3NWsRKbWIKHHOcsdEEx8cFlN57TBpO8TggCJMgB 18ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=W614FkUN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si843301edr.363.2020.09.17.16.19.58; Thu, 17 Sep 2020 16:20:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=W614FkUN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726148AbgIQXQn (ORCPT + 99 others); Thu, 17 Sep 2020 19:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbgIQXQm (ORCPT ); Thu, 17 Sep 2020 19:16:42 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBCA1C061756 for ; Thu, 17 Sep 2020 16:16:42 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id o6so3643891ota.2 for ; Thu, 17 Sep 2020 16:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=YeOyKeCzbk9VWMgOTxwltUHxECBUKayGqCzk0HAQiXM=; b=W614FkUN/tdIYzf9qMMdeL1QrJDlDKeBxOZ78PcE/uZTbTqryTGwCaQ2lVqJv3tVa6 1pWitjG94eKsyf9d9cjiOBasZyml+Uf4l1AB8P1yeTQWOGieEOHyPVWS+PuvJMXwYDpZ E0/Z/QH4vHeswWBOAz/5Vmqe3eq8nnsot4oh0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=YeOyKeCzbk9VWMgOTxwltUHxECBUKayGqCzk0HAQiXM=; b=oU7Jt1MhpGvxLZVe9QqOZcKK60/Na2TUB0QfQbfNESFswP8BSDZWZaTsOUOJsT3VUQ 3k4+nXogtzDrzCBP8j8ITURucgrjR4b2LVhIkTAMChI0fzCg9DF6DIxyR8gFM9X6IVff EK6byQSA6fWMg0yeYJsTmwmh0UgF+UyYu33A33WC+xAya4VhIO8ATWPFXbCnEYbXltOq vPrJhf0tT2sD+yxE3WO2/2gNQA4LnwiiwLaJ10k3PS8E0UfA31DePsPKgpk1DA+6S4YX 0UTWb1HRxcOJA8YWqhLzygHgbLh1S/uJ6MkISpanNU0qHXj53CXe9XI9KcDI7H3k5xqc hmnw== X-Gm-Message-State: AOAM533Qv+vO7BmWcj708/b3cSmFh6zq14v8ik+brRHKE5iIlpLEDi9h s6v/uMgQ2FezdcHEMJkyGmky8TuP9gSwYg== X-Received: by 2002:a05:6830:1e30:: with SMTP id t16mr21703501otr.18.1600384602162; Thu, 17 Sep 2020 16:16:42 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id o13sm920200otj.2.2020.09.17.16.16.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Sep 2020 16:16:41 -0700 (PDT) To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org Cc: Greg Kroah-Hartman , jhugo@codeaurora.org, sdias@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List , Shuah Khan From: Shuah Khan Subject: bus/mhi/core: Double lock in mhi_device_put() and dev_wake inc/dec Message-ID: <5029d4b5-d614-eef3-5a7a-9c8e1c3e7ddb@linuxfoundation.org> Date: Thu, 17 Sep 2020 17:16:40 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While looking at this file for an unrelated issue, I happen to notice there is a double locking on mhi_cntrl->pm_lock in the mhi_device_put() when it gets called from mhi_driver_remove() The other two calls from mhi_driver_probe() don't hold the pm_lock. In addition, lock holding while dev_wake updates is inconsistent. dev_wake gets incremented and decremented without holding pm_lock in mhi_device_get(), mhi_device_get_sync() and mhi_device_put(). Exception are when mhi_device_put() is called from mhi_driver_remove(). The following commit is where all this code is added. bus: mhi: core: Add support for data transfer https://github.com/torvalds/linux/commit/189ff97cca53e3fe2d8b38d64105040ce17fc62d It appears to be real problem. I don't have a way to test this driver, hence reaching out to let you know about my findings. thanks, -- Shuah