Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1111383ybj; Tue, 5 May 2020 13:17:49 -0700 (PDT) X-Google-Smtp-Source: APiQypK1x8FDgHzyXZBbp7mX+s2WiZpI8vPCvxcYZjb5aHBv4QtFtcx3Oh1Lxd1RFQkhmb3Oc/L4 X-Received: by 2002:a05:6402:749:: with SMTP id p9mr4037662edy.75.1588709869199; Tue, 05 May 2020 13:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588709869; cv=none; d=google.com; s=arc-20160816; b=ihg3ynMF7EnDs9eBtDSm2kn7LdvplKDQ3AHQTisR8Fa0U34zgv9jND0dTLJLdRGAb3 fJoKvFdHyAhXJ4Ir/P2qI0Z+f9Y+alzcSQCpVPKnZBe3NZdl0pFc7ptURj99IxcOb2bV dNhG647yPGR6i2fxzyS7diweJksLITi2/1aCE54UauprJeTnpxlKvIG3mVN5w+NTM/TK ic5SBv0H1rPkBIH3PzI8lP9WvRdybDL+9D1RopV/CX/fuEdY/1VZ0TU6Oj+3wz57lhk8 uzbZHxcfXE9LgziIW/W0jfnw8tAUdctrcujOFcKwn4aWhYelEtIBOTS2ctQ/7hyN2BMe 5c5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:message-id:date:subject:cc:to :from; bh=PiMfvklfclZVv8Gj4KMeNEIZv7C/wSQAeLOGi6u7/Gs=; b=lksbwSBOPh1YDXK8ofjscOb3LAbVH/9HU8AIu+oIAVtgYj5wrH9lQaP/AXUbNOUMJV t2jpVFbd72BAsKYQu7rRrbWYq8f4Iq316upLHQAhiTZV7pQUoPNAnmKEQcKpSyjG/MFA C596WrG/NeyAP0AxxGBNKhKOb0KPy13EDN7a8QE7pi6RISyNgT0yBpp8RLw/JFp1xSUL wyhvD6bFwssUGC1QMf1+ezjYKevoHSS7hCaD0vQfCmKNnj80DqVmOW0jcrO4m9VD5lmm LIiOI8PdpsmjcYUD8JcQirPx/9WvT5pXW6eWORABo+aLqpXVunv+3GDiDlaL3un8LNdE hRmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si2082589edn.445.2020.05.05.13.17.25; Tue, 05 May 2020 13:17:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729108AbgEEUPh (ORCPT + 99 others); Tue, 5 May 2020 16:15:37 -0400 Received: from inva020.nxp.com ([92.121.34.13]:52032 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727785AbgEEUPg (ORCPT ); Tue, 5 May 2020 16:15:36 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id BCCE41A0908; Tue, 5 May 2020 22:15:34 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B04251A08F2; Tue, 5 May 2020 22:15:34 +0200 (CEST) Received: from fsr-ub1864-126.ea.freescale.net (fsr-ub1864-126.ea.freescale.net [10.171.82.212]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 620E2205D4; Tue, 5 May 2020 22:15:34 +0200 (CEST) From: Ioana Ciornei To: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: youri.querry_1@nxp.com, leoyang.li@nxp.com, Ioana Ciornei Subject: [PATCH net] soc: fsl: dpio: properly compute the consumer index Date: Tue, 5 May 2020 23:14:29 +0300 Message-Id: <20200505201429.24360-1-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.17.1 Reply-to: ioana.ciornei@nxp.com X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mask the consumer index before using it. Without this, we would be writing frame descriptors beyond the ring size supported by the QBMAN block. Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring mode enqueue") Signed-off-by: Ioana Ciornei --- I am sending this fix through the net tree since the bug manifests itself only on net-next and not the soc trees. This way it would be easier to integrate this sooner rather than later. drivers/soc/fsl/dpio/qbman-portal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c index 804b8ba9bf5c..23a1377971f4 100644 --- a/drivers/soc/fsl/dpio/qbman-portal.c +++ b/drivers/soc/fsl/dpio/qbman-portal.c @@ -669,6 +669,7 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s, eqcr_ci = s->eqcr.ci; p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI; s->eqcr.ci = qbman_read_register(s, QBMAN_CINH_SWP_EQCR_CI); + s->eqcr.ci &= full_mask; s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size, eqcr_ci, s->eqcr.ci); -- 2.17.1