Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3436977ybl; Fri, 20 Dec 2019 09:15:17 -0800 (PST) X-Google-Smtp-Source: APXvYqy3b8JEmyQ1dHQIFA8ssf39NAQejRAHrAiy2gD/P5ajOQnuv7vH6MX2VgyVpsKsSW+ujtAo X-Received: by 2002:aca:3b54:: with SMTP id i81mr4561115oia.155.1576862117813; Fri, 20 Dec 2019 09:15:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576862117; cv=none; d=google.com; s=arc-20160816; b=P7NLkocG26gyWqmyxQuxhw6cJIwRJJP9SCismlsRO64p1QumLidhPJEcM8eurCD7Bd MfM/o5HCtxu/7GKxdGCne/L4NrFCNq4gipFjVCaalxHcEJfGLVP4xtO1z61cUS7htIus wissO3VCCCPWB6KMErLLqRdbGf1UCsjzAy3f6Qs8xLKFGaD53QvSTTfARLX1GrB9dV3O ydQAf4Lz5BAiNMOsdEV3FMYTc1RWe/E+HhNtyGx9VFLWyAkhAbiZXGQQb3pFWuTPvce2 RwTBtcZUY9I1gaxYgPqECYJpObLIG8q/Ny8VZb2SvAAEbGT+cte5YcyG2pRz1NSlYqB4 iwuA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=CnU4xvfoNnMFHRMSFrsXcG1YgG1fyn/xauqN1cixU2I=; b=q8qjGcI9dI2wuKe1mLLPGT2fk9gsntEcW90K4lvaPN+stWWZompGvWBE5h1FHTBd7h sr/3/MIbUKIIXTlImw8RM958JHCnFjZGx7H/ONAhD4++W1GF7aEcUo2kbgLaBwDoYN1y SR4+71/3lxIEAs/5bSw36SyIk8kTCsQcjgLkJ0hhsvLjN2gX2S7VDcMdZv5lyEFctT6w VEHTMUmJ0pQww+TSnRo2dvRcZU3VAJZ3MRxvEgpCB3z0wHX8C5HUTrcWzJxHum1AgH6p uoyQvhwFxfAH3Y/gDpoXjEFepG0DJcOsjc4x2GfmnJHJaz6UVHetEr7KZL5afsSUJrbw ifWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uYwyK2Vt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si1191077oix.197.2019.12.20.09.15.05; Fri, 20 Dec 2019 09:15:17 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=uYwyK2Vt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727406AbfLTRNP (ORCPT + 99 others); Fri, 20 Dec 2019 12:13:15 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35739 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727362AbfLTRNO (ORCPT ); Fri, 20 Dec 2019 12:13:14 -0500 Received: by mail-wr1-f67.google.com with SMTP id g17so10134395wro.2 for ; Fri, 20 Dec 2019 09:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CnU4xvfoNnMFHRMSFrsXcG1YgG1fyn/xauqN1cixU2I=; b=uYwyK2VtKQBp/NbuJmih9sxLppLZ6LHHB56L7qjb11pFtES/khKnUpWxpALlmCtVYp pmUQVraNEl5aowRXY8HqyZNdCi4v4LbGRsex6T3o1Xg39qtzJk7Y9v3VW/xx0F/pujK4 exHrBOwT3H93AQRVHyQHL/gOoq0udEoM37PYXqoOJpKlD1PFbzw94NSWVlZYWdH+On1N iDnCf/0KlnBFKVlWv4DqAYnBEOVzKV4MklX+0seFQpxMmpTHXdPBUodW34ObneBcIjqv WmIw8turqV+UOsiThIS2tkpX8ouPcNxQulPAWbQ7bWJK7FQzK+t3a978irbB/Y8ASENU t9hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CnU4xvfoNnMFHRMSFrsXcG1YgG1fyn/xauqN1cixU2I=; b=ESJWZgyRGCgIpOmooLWSQCzucriMaectEP9XgCa7L2ASIj6ThYF+lafPjzccRrpZSW TB0W6+RheoU8EtbSKw8iqE6cYaWc15nAdhMnwRO2q0M3HPMeopWvh6uuT4Tk+666K+1F YllHgIm4EwesnScpUB8bLtMDUmP67GomTkgVNFGnR92LN/XhIrmriUxzMhTSbLRIurvS InZIIfsMkYDK9tYoy1IqzDZpvRZfg00oHx0Te1bNfbZBCih16ZkdCnilG7Z/XY8Q1I4s pZHa7b4XBCt8qaIH9/DWgT0qSzCLYGu7WP/6Msed0yqROZNmFfpn3QXxwKaZKDqbah9V ihAA== X-Gm-Message-State: APjAAAX446bzB3sh36r70DrscXyCAWf2JLRZ2k3BeFpNwy7P7jANMIPU vufEbPAu5f/RYDACcdHVJrl3sw== X-Received: by 2002:adf:e5ca:: with SMTP id a10mr16179218wrn.347.1576861992379; Fri, 20 Dec 2019 09:13:12 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id k13sm10276085wrx.59.2019.12.20.09.13.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Dec 2019 09:13:11 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, daidavid1@codeaurora.org, okukatla@codeaurora.org, jcrouse@codeaurora.org, georgi.djakov@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH] interconnect: Check for valid path in icc_set_bw() Date: Fri, 20 Dec 2019 19:13:10 +0200 Message-Id: <20191220171310.24169-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use IS_ERR() to ensure that the path passed to icc_set_bw() is valid. Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 63c164264b73..14a6f7ade44a 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -498,6 +498,11 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) if (!path || !path->num_nodes) return 0; + if (IS_ERR(path)) { + pr_err("%s: invalid path=%ld\n", __func__, PTR_ERR(path)); + return -EINVAL; + } + mutex_lock(&icc_lock); old_avg = path->reqs[0].avg_bw;