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: 9353521 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 6CC8560757 for ; Wed, 28 Sep 2016 09:18:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D598293E4 for ; Wed, 28 Sep 2016 09:18:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 515892944A; Wed, 28 Sep 2016 09:18:26 +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 3341B293E4 for ; Wed, 28 Sep 2016 09:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752258AbcI1JSV (ORCPT ); Wed, 28 Sep 2016 05:18:21 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:35204 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754076AbcI1JSP (ORCPT ); Wed, 28 Sep 2016 05:18:15 -0400 Received: by mail-pa0-f67.google.com with SMTP id j3so1833200paj.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=lci7kckgxO+wqq9G2Zn0DIBETuAea74ZJYot0UjDrvl0KpGyuKhuvSV6vF5M6x3voT 8bLt93AJV1MdOyZX9sBSAx4VPGPKWqwVuVeV5GZ1GKpTF05i4SZP5axqPhtAFK21k6pK hyfl5RQxmft8+vkCTYOO4pwT3diBMCiBZbF+ASXq98SL4Ruegx3HO70wkbSdrHK+l55d v6+mUGaog7pafqD4RRGArGyJ7FfP0d6/WQUw9BpVye3nDwUS3KmnMOrW+nY1UjHvkQGN PP0fNRfsAqg7VKg8pYaJrOskfjq6c8TYoLLGt6v/OKhdz5b24nC0ki+E1F0zbh0qJksQ SBJw== X-Gm-Message-State: AE9vXwP8l+dQ8bi7Na0nIT0NXfzDwbQjR1l14x6z1jHS/gjmK0o6fj+s7h47cVcJfMFe6g== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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);