From patchwork Wed Sep 28 09:17:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 9353523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6329760757 for ; Wed, 28 Sep 2016 09:18:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D124293E4 for ; Wed, 28 Sep 2016 09:18:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41116293EC; Wed, 28 Sep 2016 09:18:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08D6F293E6 for ; Wed, 28 Sep 2016 09:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752366AbcI1JSU (ORCPT ); Wed, 28 Sep 2016 05:18:20 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:35204 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754006AbcI1JSP (ORCPT ); Wed, 28 Sep 2016 05:18:15 -0400 Received: by mail-pa0-f68.google.com with SMTP id j3so1833201paj.2 for ; Wed, 28 Sep 2016 02:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=7h0MbNQP2JEDxx+Ykw1PFCKKedJijD1vHKz7sGkvUdE=; b=x5t3uPvxQaWRttB4GC937BMtXEfLKq0F8858cJnFWaA00KIh7Rv94rt/JTVqgW9EDH ynxogugBAbiUz5RZqig1G6ychQ+muBDp6zA/BDmHrCkhxGrX2DmYGAtToa8f9GEOcty8 r7eu2npY1mZ8YRNM8e4JwME3Nap4ZA+j26oFw5R+MdVUgbf0Sl9zJyDnWLrOH8+DIBn6 jZINBUmfbmFw6ti9hne2H79cYHbyGrUXgrKIuL5AIKZXx7ygo+QryA3vXRX2+ieDqwDf qbzlmCtBip+M8Kb01fTOZd9FKnNAHERBYguQahSa1cF01AY3OSQU1yg/UD5UmKBuOWgi rPdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7h0MbNQP2JEDxx+Ykw1PFCKKedJijD1vHKz7sGkvUdE=; b=Ln9efeOfe2p9XMxsnCs6g9oVHyd6CGblJkzFqVkMOE3DeLLzgbGYwZNB6f5xW0EDkd sSS9eebbjw61TM2dbIUEtUd7kiN5CI8qWwBOT6h4R6IQl8apF6XOD5BnwujG6GNn7FYc P/Q4hcqedE37oVjxhnHKsFov0YZ2WaBONMuJPah3CETbPkZtcvtOwwUGmK6rqxZ+yNRf rNRxAjNrzFi4VKKclM1SWCQqIc1wdosZKlEmena+69TqSkE8wvwYmDgJnpfTdlHgfE22 OBlcv6uH1vihVWpnrSrX1KM/vjLClSiDnlGBqUxzmFm6SlfdLt2q+fHg9numUJCAeBL4 xl0g== X-Gm-Message-State: AE9vXwOAjCVyW4s2hx4dXhvDtzxmKnwBhjOATbOS/e3HR2wCPf72TLLwxO90siuERfbjmg== X-Received: by 10.66.160.72 with SMTP id xi8mr55765353pab.78.1475054294099; Wed, 28 Sep 2016 02:18:14 -0700 (PDT) Received: from localhost.localdomain (218-164-24-34.dynamic.hinet.net. [218.164.24.34]) by smtp.gmail.com with ESMTPSA id b88sm10762224pfe.66.2016.09.28.02.18.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Sep 2016 02:18:13 -0700 (PDT) From: Axel Lin To: "Rafael J . Wysocki" Cc: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Axel Lin Subject: [PATCH] PM / devfreq: Add proper locking around list_del() Date: Wed, 28 Sep 2016 17:17:56 +0800 Message-Id: <1475054276-29528-1-git-send-email-axel.lin@ingics.com> X-Mailer: git-send-email 2.7.4 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use devfreq_list_lock around list_del() to prevent list corruption. Signed-off-by: Axel Lin --- drivers/devfreq/devfreq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 478006b..70369b0 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -604,7 +604,10 @@ struct devfreq *devfreq_add_device(struct device *dev, return devfreq; err_init: + mutex_lock(&devfreq_list_lock); list_del(&devfreq->node); + mutex_unlock(&devfreq_list_lock); + device_unregister(&devfreq->dev); err_out: return ERR_PTR(err);