From patchwork Fri Mar 22 16:17:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160949 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp994413jan; Fri, 22 Mar 2019 09:18:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEksJQEze6dqn3l5E+HXM7qcDNjbuX+vuTuG5Fau6cRgMVdjw2C9+UlBsBkBPxK45QGyfJ X-Received: by 2002:a63:6193:: with SMTP id v141mr9669127pgb.392.1553271522697; Fri, 22 Mar 2019 09:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271522; cv=none; d=google.com; s=arc-20160816; b=TZdy3HXud5Jv5jbCN1xqplmZl0q8HpbECZe/WSwWwXLDqQtwrxyE2kUa3BwbP1YM7c yWHd4G8ySQ4GifPbymrRpl0d/yAPCvTz3DBsDA9GM43xxEkBv/ZZ+Cz2slHtdUpGtoAB VxHXN0T/JNtstuV6jxq8GSZLhBH6jWgcWP6HULV8KBlqLuwqowJuq1h9IGwuaGs07Vv3 dAjcoK1G0dN+AszCeAtQhsxKaQvkqo1ngmONE8YlyULhBYCgqxn/wDA5RBhP4r2H9Z3d +jpZo37rS8oJPFU4kUV6zW6gPHRbMgW071aRsi6ajek7N4FIr+TEn9M6utzUYNe8IzDM W4nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PPKzMjbjXv312b8cWBdVZu9LEsVF+3skdXIM8MiK81o=; b=nNPbKaZfFKpJ/KYxLi6vVlXWlUZ2a43Yo80H1W7OLszkza/wWq8JPLTE+viGH26iwN RbUFMBYN3QNxOptyF38RtGICKprEcKi0oQxERiWQS/HeuWNTkmLwRgI7fWzT0iNmk6sr eyyCPXXGsWL/GyCfkN2nOxgdwmZAWAFUB5dBu9EBN44/YADqYdeyA/YcQHmwc0t0fqXQ /4BGXv5nvOEsVMH0oK7ySdIyMHBluvnJwEnnYJJ6EtpFyWa0Fe+euOKs2xGqHnIqg8FL U6lgPeme8GEQVb+hw+ecwfvaApxbywhx9HCmxAUcqmuI/ppa4HhtVPT7WyCZpC3iD3Q6 koUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d195si7287812pga.309.2019.03.22.09.18.42; Fri, 22 Mar 2019 09:18:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729714AbfCVQSl (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:41 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:39111 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728017AbfCVQSk (ORCPT ); Fri, 22 Mar 2019 12:18:40 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mw9Hm-1gosZt2rSu-00s8H8; Fri, 22 Mar 2019 17:18:05 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ingo Molnar , Peter Zijlstra Cc: Jules Maselbas , Chris Redpath , Dietmar Eggermann , Linus Torvalds , Mike Galbraith , Patrick Bellasi , Stephen Kyle , Thomas Gleixner , linux-kernel@vger.kernel.org, nd@arm.com, Ingo Molnar , Arnd Bergmann , "Rafael J. Wysocki" , Greg Kroah-Hartman Subject: [BACKPORT 4.14.y 6/8] sched/cpufreq/schedutil: Fix error path mutex unlock Date: Fri, 22 Mar 2019 17:17:21 +0100 Message-Id: <20190322161727.1153278-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:MXmycvD1CtaPZk6JuDv4SojVbiweK06JIhz6y2x882YX36mi0DM jbWkydyoobkg+9z0Zc9Gy3DjX9YKXIHqqoPZh5mg508pXHXhGfsnl3ltLgbRic/ddfYZX6T LCEQSKTRZKaiZfLjsDhFWC59O0Xt5EFTZ0cjXan43UPZsQ2whGuvO/Z49yQCqoMeNcP4EfV CveReTpzT4oshyzdGPZmw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:4Lwf+QVPKuE=:4vgzKyqxEq7hRMJ9UyPWm5 UCq/pC1jputQqbYgzbaDOa9ZBx7vDAH2eakVJcA2UdyqqRWV1gjVWtH8eK/HlNWXs/TW1cfjH xdvbN2nnTjTSbsWebK+Vy5BCLdARp5Z9G6nnz2wmt7r6dGTu/OXfHyXj7XxLbzskOAhd+34X3 DdA/oIQKiIVZdZv/Ak0I1xT6p0xmto5j3uxxffY/PA5gsy3elESlSRV0T6fzJsdUIHQQoa8zl +X5O2K5nvfSgVd+49idZug+2ymzi+5G1UVi8Q8bWCiwpuExhxwQph41LaHzMEMv/NZ3+usVHJ 4du+7RbuwxwhZlaGH94I+ZYD+Eyph0kxGGyJeX+wcaIMfcSptbnRjHHnTrtzhCa73wZKswjS4 CvchHpxk5xoldgSY8LRO81x8iS3kg63YliIH9WXDQhAaiPVUHz0oYR3toID5UKLFfm/eAG8EC /oFFux0WZENd+i/rM3xOV2JZ26lHZ51sHr9RZCogRrV+ZI4kYKb56pIYEUQ5pS+sbcBrb/nTV yY3FW4VV+/NWSA/srg/+vCEyRBUyicSmfMn8G1vO6GgNRlNDZYyNuWFXX70stvDG4w6Jib8b0 5S4Wn6AzS8BMsloz5idKtSXTROc9A4KGgUXonqF1w/t3lwMFs0HSUhAgNByUv5Rh8I2up2X2+ 1xQ15PnASE92P7DbJEwNj7bg/bgwFDzcjXhJfeMkYGVf15ks4BeihBhyjheuTeqB0219oETBi rpTb9t1YE8OsRkk41JGR8TPWBB4X1jbnmBs9ew== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jules Maselbas This patch prevents the 'global_tunables_lock' mutex from being unlocked before being locked. This mutex is not locked if the sugov_kthread_create() function fails. Signed-off-by: Jules Maselbas Acked-by: Peter Zijlstra Cc: Chris Redpath Cc: Dietmar Eggermann Cc: Linus Torvalds Cc: Mike Galbraith Cc: Patrick Bellasi Cc: Stephen Kyle Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Cc: nd@arm.com Link: http://lkml.kernel.org/r/20180329144301.38419-1-jules.maselbas@arm.com Signed-off-by: Ingo Molnar (cherry picked from commit 1b5d43cfb69759d8ef8d30469cea31d0c037aed5) Signed-off-by: Arnd Bergmann --- kernel/sched/cpufreq_schedutil.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.20.0 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 81eb7899c7c8..b314c9eaa71d 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -605,10 +605,9 @@ static int sugov_init(struct cpufreq_policy *policy) stop_kthread: sugov_kthread_stop(sg_policy); - -free_sg_policy: mutex_unlock(&global_tunables_lock); +free_sg_policy: sugov_policy_free(sg_policy); disable_fast_switch: