From patchwork Fri Jun 10 00:22:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 69737 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp37896qgf; Thu, 9 Jun 2016 17:23:04 -0700 (PDT) X-Received: by 10.98.105.138 with SMTP id e132mr7431375pfc.59.1465518184883; Thu, 09 Jun 2016 17:23:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l82si9363722pfa.120.2016.06.09.17.23.04; Thu, 09 Jun 2016 17:23:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751732AbcFJAXD (ORCPT + 3 others); Thu, 9 Jun 2016 20:23:03 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:36462 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbcFJAXB (ORCPT ); Thu, 9 Jun 2016 20:23:01 -0400 Received: by mail-pa0-f51.google.com with SMTP id b5so17862771pas.3 for ; Thu, 09 Jun 2016 17:23:00 -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; bh=TpNcYd3RPRYBTiFm1alvpg2oJumidJxy6hxtZ4IpG/8=; b=co8pqdnEY38+zsTsq/+WC63QwX/piima9ije2dzr1O+sElWKpPC9skbqqBpjrcTf9S N841wrnpvpLn/qUNLt8uGrH8Pmnep0p6/RTZ/ANCG5m5ObMb9hIKyoFDAb0dAiOVwQ6w lRCCDYtSLPKa7t4B3utBNUv6PCAYhC/SjRzEk= 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=TpNcYd3RPRYBTiFm1alvpg2oJumidJxy6hxtZ4IpG/8=; b=Gg4sBP4p+r9fr4pFYOKn71duyDKLeoknLu2w5uxZJ7wf7Wzu+m2ouoz7J65qptmcOy SGRc1FhYEZ+IqV9MSsHXzY6VJcf9nkhRmhtVBbrHowdJo3MTOCQnUoS6xXOmIAcBUcW2 VVOL/c7Wdm226qBeQIL86ElBtr2KjPPBqQWbLCfD8biNsms1/N2fOHRk3/BibyiyxT9h gxdZA7+FgBbu5Xups+mr/NWz8ZoW9MXBrDRLZJ/niFkQsKuwoe8AX9iQgL1B+m0MITCA midcUJ0zCRBZk8IcmCaAj6S67rsJAELV7puTj65TQruZX74tjL/DaZLmY8+kzOhlK0oD yTfw== X-Gm-Message-State: ALyK8tJQSE/f1ssvPXi9FrXoA10dfZOSww2twrEtl1r1ccMo0r0AVVbEObHwSwyqi3mKABXQ X-Received: by 10.66.231.68 with SMTP id te4mr15202487pac.16.1465518180286; Thu, 09 Jun 2016 17:23:00 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id v1sm12642776pfa.93.2016.06.09.17.22.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jun 2016 17:22:59 -0700 (PDT) From: Bjorn Andersson To: Andy Gross Cc: linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT), linux-soc@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT), linux-kernel@vger.kernel.org (open list), stable@vger.kernel.org Subject: [PATCH 1/2] soc: qcom: smp2p: Correct addressing of outgoing value Date: Thu, 9 Jun 2016 17:22:56 -0700 Message-Id: <1465518177-14594-1-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The valid_entries index should not be incremented until after we have acquired the pointer to the value, or we will read and write data one item off. Fixes: 50e99641413e ("soc: qcom: smp2p: Qualcomm Shared Memory Point to Point") Cc: stable@vger.kernel.org Signed-off-by: Bjorn Andersson --- drivers/soc/qcom/smp2p.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index f1eed7f9dd67..9c2788b8f2c3 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -344,11 +344,12 @@ static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p, /* Allocate an entry from the smem item */ strlcpy(buf, entry->name, SMP2P_MAX_ENTRY_NAME); memcpy_toio(out->entries[out->valid_entries].name, buf, SMP2P_MAX_ENTRY_NAME); - out->valid_entries++; /* Make the logical entry reference the physical value */ entry->value = &out->entries[out->valid_entries].value; + out->valid_entries++; + entry->state = qcom_smem_state_register(node, &smp2p_state_ops, entry); if (IS_ERR(entry->state)) { dev_err(smp2p->dev, "failed to register qcom_smem_state\n");