Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp83498pxb; Mon, 13 Sep 2021 13:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC8fVzX9fn/EgM5kYc0MjzaSmbJfZJ1OTIScP6NWPkxuFy/HV3bvspPjUYpMLeBCVj+xEY X-Received: by 2002:a50:cac7:: with SMTP id f7mr15131525edi.302.1631565291528; Mon, 13 Sep 2021 13:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631565291; cv=none; d=google.com; s=arc-20160816; b=TELpcqDhkJKuyrzn83/hfzAzWxNrqZxMXj4GYDovqHRpzYgKq7CsGnLkV+Tx2qpJSU T02yTF5w1XBtkGMKT3Nag4x0hMhdbXUpJQP0EHZvracq6FbvFL6Ynqtw5uNN0GsH2VMQ 5xyzf0Aong4hnmarYEhPN6OrBvYMT1iY1vQ+BpD7ZljYZGjvgojDzqjLOTGvW0oMjXA2 P02/1wlEQMsm9/fHIxBMrUJrExDZha01hieCGvl93VLW6ttSLvO6+fFbaxZKhsLx4t31 lEQXDQgtu8vKKH/CKSLW9+RLjylB6lLGAvMEeGdGzYToIdvpQU58vfJE69hWnpe1Qlk8 pUFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QGZrOtVghduiMRdsOZYQaM6tDCj1dB7rlhrwY5nq7Cs=; b=f+wM4XNPFqCN0VeJjlnoe/YUkOcBRtU7ZXZ3slgkobhtcnxHMSQlQu3WeWH9dYopxx kmbkTMWW1z6wHPz6JglJUiij3SvwRH5i8YZ82StswonEAEN1gzeY2VK7yhwvN+FiLE+Y Gsabz8wkvCAA/HRwKNBYECJ3pHGJzR0NCEcH8JtGRufgWeU0Y1BO4gkCagH/FBV6vKBz MpdAa22RcT1Zrs0hAWmi44zsNh303gE/mIeHrTwWI79wD+3GuGxxdtLkuVEVC4/a5qEV n0Du4t3badXwjpcqfwxH8D0TUtKRDZaJjxoFwiGYq/6lS5AMqdRnW8KOka9ma4t/5t3A Youg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yiNo3BZk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v4si1540131ejk.129.2021.09.13.13.34.27; Mon, 13 Sep 2021 13:34:51 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yiNo3BZk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243647AbhIMNl0 (ORCPT + 99 others); Mon, 13 Sep 2021 09:41:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241299AbhIMNgQ (ORCPT ); Mon, 13 Sep 2021 09:36:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E67E8610FE; Mon, 13 Sep 2021 13:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539643; bh=7IiXsDjGteExINZcndnmgC91TIRkv8xhMZey/zp+I2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yiNo3BZkgCSWauSulQ62apqbg3djEX9F2zmbyz9rxQl1r1dv2OwERhJhzOU1h4jCK z6yDDtx9b07i554RggSaX0x6wDPcz4oNpS8424uxX0igDUVx7Z3P27XAGgeembRdbh yPDVVkfmoot9dz3OGAxwY+tsE1gBFVNAj4P5NW7M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harshvardhan Jha , Daniel Vetter , Sasha Levin Subject: [PATCH 5.10 070/236] drm/gma500: Fix end of loop tests for list_for_each_entry Date: Mon, 13 Sep 2021 15:12:55 +0200 Message-Id: <20210913131102.738844806@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Harshvardhan Jha [ Upstream commit ea9a897b8affa0f7b4c90182b785dded74e434aa ] The list_for_each_entry() iterator, "connector" in this code, can never be NULL. If we exit the loop without finding the correct connector then "connector" points invalid memory that is an offset from the list head. This will eventually lead to memory corruption and presumably a kernel crash. Fixes: 9bd81acdb648 ("gma500: Convert Oaktrail to work with new output handling") Signed-off-by: Harshvardhan Jha Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20210709073959.11443-1-harshvardhan.jha@oracle.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/gma500/oaktrail_lvds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c index 2828360153d1..30b949d6856c 100644 --- a/drivers/gpu/drm/gma500/oaktrail_lvds.c +++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c @@ -117,7 +117,7 @@ static void oaktrail_lvds_mode_set(struct drm_encoder *encoder, continue; } - if (!connector) { + if (list_entry_is_head(connector, &mode_config->connector_list, head)) { DRM_ERROR("Couldn't find connector when setting mode"); gma_power_end(dev); return; -- 2.30.2