From patchwork Tue Jun 26 00:58:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139903 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4616976lji; Mon, 25 Jun 2018 18:00:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLM47rjN7Ibmi8/Ytvz+XU6hbuLWA4L3pdbDyEFIgwa0hI2CCHTVJaCwAm38Dcnyjq1qTN7 X-Received: by 2002:a63:9b19:: with SMTP id r25-v6mr12097968pgd.197.1529974853243; Mon, 25 Jun 2018 18:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529974853; cv=none; d=google.com; s=arc-20160816; b=bMAZxYZ+vmMPhngjVeQG+3OjrXHO704mHXsg1oEB4i0L04dpkKx2O7+1eyx0AqGYdw RYIuspnP3I0eadBNp4llzo7z9Bix/g2/trymiQ74/F9YLvf//5ukcDEnFWDDikEyPdmi 3y5HKW8EX2iwSiQf7+Fs6aInbyEFBckEKmuZHyv/yLINmGoCyRttS2pPCFovBQcLAIxR WDwjUmSQAzjsjzffUK9euDepFA1fh1cguzbq5xEjdMGOUvFoKjc5/l1fa8yFmEFZxpy9 /EtgO+svZeKuH0MNpcepvSM+3PamuELOOXVaw9YT1iYmCZ7J4LbzxsVTE33VOQCNERsM XK+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=U42+N/Pr+kSZibonyjndzWovOO9lsASoVNkEMXPj8tA=; b=EVOLK5axVWFFXlQYGw6ypfmtoDNz4ZGKo1aVZWW9Q5kVNzc47rDG+zDcJCNXAyK9fg XMuq3IyhKDNwFGGzKuEhsXFNZsbx8FTcmOtny2OmXRkx3/jyjHwvXIz8hrgisRUV3AQY hBOGWKJqAxcway5MhNpzaKhYCZPnuIXbxAumoKYNCkz0XPKdhvb6VuQ/Z/557RbzMPhW lzG4mN7sLY3jvyu79R8FUB+7iI8ojbLHzoTuqzna3+Eze3P66ERyr80VmXTSd3JsTrxM M1z7Zu+UREtRG4eLpVlyqKsmzRAvR0CMASVh+Srv2Wyis2HY9yq2fCNblgdkQtS6V8W3 Y8FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BC9LJmh2; 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 g17-v6si310563plo.355.2018.06.25.18.00.52; Mon, 25 Jun 2018 18:00:53 -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; dkim=pass header.i=@linaro.org header.s=google header.b=BC9LJmh2; 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 S935180AbeFZBAv (ORCPT + 31 others); Mon, 25 Jun 2018 21:00:51 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:53196 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934558AbeFZA7G (ORCPT ); Mon, 25 Jun 2018 20:59:06 -0400 Received: by mail-it0-f66.google.com with SMTP id m194-v6so15207914itg.2 for ; Mon, 25 Jun 2018 17:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U42+N/Pr+kSZibonyjndzWovOO9lsASoVNkEMXPj8tA=; b=BC9LJmh2L5hpLyHG3T84x5UZ5U5DhGzecGtUrmIT+Rly7V1hopxHHblcP6cfOEtzkO ZzmRAHEAJ8JRGys9QRqZUSXmQQ9KIW8gpdlvG50MM95IF+NNAw//Ok5IIhe7otASbciX yqsrdWH68/AA2trGqONsYSOrh6ShggL/c/ox4= 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:in-reply-to :references; bh=U42+N/Pr+kSZibonyjndzWovOO9lsASoVNkEMXPj8tA=; b=LJm2ZcppjrstZmKWrQNEvwnyymw/ZXiHi2d5vyhmbpK8XAhDu+a3U6Ht7i1eBu0eLi wA2N482VCJrZiz/D87gg+c08bdnwn4lcgSDnluz6SnFtcot5FVY3k6yQ6+bhuzr9g/jW AXfIpHdwWU/ztp3AVDZVPbl/CxzEWRrThCnmeFq8zYAUN3/qB6LyMZHdHp4ZiIq2PwYL zm44Gp8RlzOfCy/ujCMb3Kj78i7M7EVdrRYnKiQE4E5ly7xCVpWpKcn4oy+5N4+Lmhhm cwxkxlI4bDjVrx82fZrz3Y6mXb4nf5l6nFO20aMtpm+NOAfKmy+JOldMXQTcUecTK+25 jRDQ== X-Gm-Message-State: APt69E2RGWGNg+LozbNq6ActLIgLQpaxAr4TKqId8efV20+lA7hLET6o pAFwuogM8G27lr3d181lsGC0cA== X-Received: by 2002:a24:9b82:: with SMTP id o124-v6mr2598325itd.56.1529974746126; Mon, 25 Jun 2018 17:59:06 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id f193-v6sm372556itf.9.2018.06.25.17.59.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 17:59:05 -0700 (PDT) From: Alex Elder To: andy.gross@linaro.org Cc: clew@codeaurora.org, aneela@codeaurora.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH resend 05/12] soc: qcom: smem: verify both host ids in partition header Date: Mon, 25 Jun 2018 19:58:49 -0500 Message-Id: <20180626005856.14174-6-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626005856.14174-1-elder@linaro.org> References: <20180626005856.14174-1-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The global partition is indicated by having both host values in its table of contents entry equal SMEM_GLOBAL_HOST=0xfffe. In qcom_smem_set_global_partition(), we check whether the header structure at the beginning of the partition contains that host value, but the check only verifies *one* of them. Change the check so the partition header must have SMEM_GLOBAL_HOST for *both* its host fields. Signed-off-by: Alex Elder --- drivers/soc/qcom/smem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 5d3ed510e54b..6931602d9a9e 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -769,7 +769,7 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) return -EINVAL; } - if (host0 != SMEM_GLOBAL_HOST && host1 != SMEM_GLOBAL_HOST) { + if (host0 != SMEM_GLOBAL_HOST || host1 != SMEM_GLOBAL_HOST) { dev_err(smem->dev, "Global partition hosts are invalid\n"); return -EINVAL; }