Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2281057ybl; Thu, 19 Dec 2019 10:57:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxFvRuBedtnvRO8NML496DN+TiVWrO0wfWYOgko7MtdYagsZh0vL+4MbrZvmxcC4kBHahns X-Received: by 2002:a9d:51ca:: with SMTP id d10mr10083158oth.76.1576781842308; Thu, 19 Dec 2019 10:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576781842; cv=none; d=google.com; s=arc-20160816; b=GUT3xw/6I4QAtm0UZldPpZiO1o+W7sKsSh97Ngixu2OI8MM9t1UMXqplXbHNdUBUo8 Id9we7osZm+nVJ+AQyBNkZT8MEp61iyzkMX4/PjrXN8jlEXVDAnzC7tJKSd9XexAkQCb SctdKw5ZJmg7l90iDn34fxi8EdqJMUHcJl6YHkRZTXvuDk2z2KmVuMnS3Rp1HjlbktSh 00o7UXAcHVlhPFEkzf4+3ZANDz2P7AOYL/bNTDwqI2FLqLJqwu+LHsL35avgNkA/Wwr/ bo3h1TaB9cNorypDQZEEp03JSLwcBltiAg+EdJHnc0syErmES4rc3dKgOxDDx4wOf/g3 ISRA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iaLVodLYh9y6p9GUkzxQRaLEcDUE0sZF0GZwgC/Vjms=; b=0K+GQmByytKlQs1cA0vtO56kOSETsEzhf29COekPj3yTkholgNHaF/4toEF1K1/89/ mw+yTwoQwg+3oq5iB+Bgb1wN5bglCQqUH2ZRbUxkQQliQTZcVhAjiBJ7tOhaIxXlXhs2 +Y/B2YvDXc31L+IRG8EoLtrFDPsTOm/0MqoXpH+xP0YU4lN+X/iB9y5rNfsaEXaV7Yn8 wxRi9v2EDbmGEDlhGsA9NXoUfqIxrWSDERleEJ5LlzOz5VQlbbBbbt+Y1WuKWWVEIDBL 7kw8LDWXgJNLU+MnChQ1Swvt2G85TJVoSffPvAyDDpvEUYI1eH7oRcTP8hll6PlhnEZN VR+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0Hsx16eQ; 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 i10si3932844otk.195.2019.12.19.10.57.11; Thu, 19 Dec 2019 10:57:22 -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=@kernel.org header.s=default header.b=0Hsx16eQ; 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 S1730782AbfLSS4L (ORCPT + 99 others); Thu, 19 Dec 2019 13:56:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:52518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730770AbfLSS4H (ORCPT ); Thu, 19 Dec 2019 13:56:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 51FA024676; Thu, 19 Dec 2019 18:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781766; bh=/+jet7Gbsw9Dd08gHvUBpEqgl3/xuwlJcZxKhbSxFwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Hsx16eQz3gM/M0s2hY/qEb9Dliatr04b44SJeZ98IGI8kZc55ez3/Tw/5g7bKxd9 NLcUmbhMuudpUhwZ84RYOZ7hXiHBFXw3NO26aWHbUSrt4olrp4PldS0DRO+TSpjKTT scXKcxRyJFcvuXdpRfSZPBFgjhcC89qcq8bZXQEw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wayne Lin , Lyude Paul , Daniel Vetter , Juston Li , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 5.4 71/80] drm/dp_mst: Correct the bug in drm_dp_update_payload_part1() Date: Thu, 19 Dec 2019 19:35:03 +0100 Message-Id: <20191219183142.235583184@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183031.278083125@linuxfoundation.org> References: <20191219183031.278083125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wayne Lin commit e5a6ca27eb72c67533ddfc11c06df84beaa167fa upstream. [Why] If the payload_state is DP_PAYLOAD_DELETE_LOCAL in series, current code doesn't delete the payload at current index and just move the index to next one after shuffling payloads. [How] Drop the i++ increasing part in for loop head and decide whether to increase the index or not according to payload_state of current payload. Changes since v1: * Refine the code to have it easy reading * Amend the commit message to meet the way code is modified now. Signed-off-by: Wayne Lin Reviewed-by: Lyude Paul Fixes: 706246c761dd ("drm/dp_mst: Refactor drm_dp_update_payload_part1()") Cc: Daniel Vetter Cc: Juston Li Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: # v5.1+ [Added cc for stable] Signed-off-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20191203042423.5961-1-Wayne.Lin@amd.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -2465,9 +2465,11 @@ int drm_dp_update_payload_part1(struct d drm_dp_mst_topology_put_port(port); } - for (i = 0; i < mgr->max_payloads; i++) { - if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL) + for (i = 0; i < mgr->max_payloads; /* do nothing */) { + if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL) { + i++; continue; + } DRM_DEBUG_KMS("removing payload %d\n", i); for (j = i; j < mgr->max_payloads - 1; j++) {