Message ID | c1030f3a445ee130c6a582fe10431c90018278e5.1689252746.git.geert@linux-m68k.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1834257vqm; Thu, 13 Jul 2023 06:43:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlGPYF2JNJL8MT8p6yq+nujlmZ2yTGmSAlY4bYOWAsaIbCj+QzuHqsFQNGQ0p5ce0ESJ6Unr X-Received: by 2002:a05:6a20:54a3:b0:10b:f590:5a1f with SMTP id i35-20020a056a2054a300b0010bf5905a1fmr1197770pzk.0.1689255835825; Thu, 13 Jul 2023 06:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689255835; cv=none; d=google.com; s=arc-20160816; b=MmlidUBI04Ei46pJVpColnjrsx4Ra3mZoC8i/eP3RQhiMP8G8dWvMmdpHnd0FVJyhW +chPOFzrIcp32wixBRMRRVT6H5TyEdvWu8wr7SBz4rZrTml9mux3ZjhxrBCG0wy5Smvs MFM5aUaubmY+4fHgKR+QnzIk+2yVpK0IJTICAx/UaqjbXXQSM1v14lCqvu1gV5i2IebK r/aFCwf8pdg5HT1cpeg2c7RcdBUSAl5nax9E3kxfsxM4hPUJcJI33hhIvlxurS2HphNz fFwOjgpTLh7U6EYWghU30wmvHa3UcBHBNrA4qHiicJmEUG6NGplADTQb29OC22xYUKhn AAUg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NygaF4PK7WxAH7U+IKXWA61yrEEURoEnlgH0pj8Tf/M=; fh=wcJXU+GRAJ+lFf7so8itXL2pGJ6fujr2XomH/f1be3s=; b=n1O6OWEkb7phn3lMoWOVO8GoEw5DTR1px+jzhkxqHMO+nGBkIBHBwVxsuCpaiXRFN/ Y16ZwcwXcBdBIvIqBWFBOlEnqRzLur9Dfg4RIwgQfjNZeb9Z9myfWH9RP5QcLl5mLTew X/dzeVeKbzywzVlIAHrig5S80Nw2RVdD3a6Q3gScCQPU5VsUr0g74AHanguovBheZjTv zVkdStcRldiiCoMVXkJfWX4v5sG0nWDhE4v1HS+j/CpXmaiiHpYb+kl4ZAl4Tk1Q0D38 ZbFqdxbKDIYEUn+df/pSbd3VWPjwUhgKfQmG6hpPJOoDOAt+tGHrLCJJYpmUkzgcLph8 7oZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056a0022d400b00682646da338si5309141pfj.60.2023.07.13.06.43.43; Thu, 13 Jul 2023 06:43:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234692AbjGMNSJ (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Thu, 13 Jul 2023 09:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234827AbjGMNRc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Jul 2023 09:17:32 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A2DC2711 for <linux-kernel@vger.kernel.org>; Thu, 13 Jul 2023 06:17:25 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:6264:77e5:42e2:477d]) by laurent.telenet-ops.be with bizsmtp id LdHN2A00R3wy6xv01dHNpa; Thu, 13 Jul 2023 15:17:23 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from <geert@linux-m68k.org>) id 1qJwC3-001Gqu-1Z; Thu, 13 Jul 2023 15:17:22 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from <geert@linux-m68k.org>) id 1qJwCA-00GWyd-No; Thu, 13 Jul 2023 15:17:22 +0200 From: Geert Uytterhoeven <geert@linux-m68k.org> To: Javier Martinez Canillas <javierm@redhat.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven <geert@linux-m68k.org> Subject: [PATCH/RFC 3/8] drm/ssd130x: Bail out early if data_array is not yet available Date: Thu, 13 Jul 2023 15:17:11 +0200 Message-Id: <c1030f3a445ee130c6a582fe10431c90018278e5.1689252746.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <cover.1689252746.git.geert@linux-m68k.org> References: <cover.1689252746.git.geert@linux-m68k.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771313127482629474 X-GMAIL-MSGID: 1771313127482629474 |
Series |
drm: fb-helper/ssd130x: Add support for DRM_FORMAT_R1
|
|
Commit Message
Geert Uytterhoeven
July 13, 2023, 1:17 p.m. UTC
Calling ssd130x_buf_alloc() from ssd130x_encoder_helper_atomic_enable()
is too late, causing a NULL pointer dereference:
ssd130x_update_rect.isra.0+0x13c/0x340
ssd130x_primary_plane_helper_atomic_update+0x26c/0x284
drm_atomic_helper_commit_planes+0xfc/0x27c
Work around that by checking if data_array is valid.
Obviously this needs a better fix...
Fixes: 49d7d581ceaf4cf8 ("drm/ssd130x: Don't allocate buffers on each plane update")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
drivers/gpu/drm/solomon/ssd130x.c | 1 +
1 file changed, 1 insertion(+)
Comments
Geert Uytterhoeven <geert@linux-m68k.org> writes: > Calling ssd130x_buf_alloc() from ssd130x_encoder_helper_atomic_enable() > is too late, causing a NULL pointer dereference: > > ssd130x_update_rect.isra.0+0x13c/0x340 > ssd130x_primary_plane_helper_atomic_update+0x26c/0x284 > drm_atomic_helper_commit_planes+0xfc/0x27c > > Work around that by checking if data_array is valid. > > Obviously this needs a better fix... > This should be fixed by [0] so we can drop this patch from the set. [0]: https://lists.freedesktop.org/archives/dri-devel/2023-July/413630.html
diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c index b4c376962629580b..8ef5f61854fd7340 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -481,6 +481,7 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x, struct drm_rect * u32 array_idx = 0; int ret, i, j, k; +if (!data_array) { pr_info("%s: data_array not yet initialized\n", __func__); return 0; } drm_WARN_ONCE(drm, y % 8 != 0, "y must be aligned to screen page\n"); /*