Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5374201pxb; Sun, 13 Feb 2022 19:01:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfO6zwXKizOIws7aeuxGmVpZ6du2M5Ki8l2nvp4Bo9YKz/omEfJT/wkoMjSnRDrjh32LfX X-Received: by 2002:a05:6402:11cd:: with SMTP id j13mr13625688edw.351.1644807695599; Sun, 13 Feb 2022 19:01:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644807695; cv=none; d=google.com; s=arc-20160816; b=obIFncNBPWKLBCVJriTFGeMKZua29l6GWZ2tg+i9OL7Zm/tZNq4r/tT2iE8wYk7nu5 0MfvYAglXxsJMsjrB9/1ravTJTY2bcKvNDDoCLRXhzvUMdhC+4dArTzcmrflId5Gc718 b65USgZx9IQzEgF4zjkBOFiH2qE1lLBKZrhfPPTh8gRE8RgF7UhXBFxqyJ/U0KnpduY1 b73+8QZn10T3zvhvL+h5QvO1r0+LrUuH5PKI4FD/FSNZUEP+YJl3vXUZn6oXbUmtdXEY 2fX+Y/HsdrvG9LkdVsCEDg6LmoMcotGLasF8UF3JXzi3vvI2uqKYNHuMXisLZ0mKFkkA EO6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=rm8gOy2vMwsXPCgipwK1rcumwj46w+8m1i8BAYiCMCE=; b=0nWGU5GU26O1LMsw+Ly1h7EZJ4l2xopW4kipe+3pw/AjAE+m/eJkclT0Dh09G62oVA AjgCXUEaqUb7d/8tafOZviauBd5f/9bLM1r0S9iUnR/iGef6xCxfGRBUDSFWB0GXlR7R LGODRpLkd6Y+4iOsvqua7E6FQQeGfZXI/zLbZF4U7IV9B2zAXHsWJjRG25Z9bDvFtzwC X80wAhVS+nEj1hsFIkBYbJUbHpEjGfmv8gdPldLdATbOT39EZo7NDvBhvISbtlurI8ff Lct9ua4qiyMhq/EAY9sH9+XrcHPT9Wms4t7oR/LAf/n7LffRZS05MRdbZBE6BYaG9tri OW4A== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gl1si7804888ejc.831.2022.02.13.19.01.12; Sun, 13 Feb 2022 19:01:35 -0800 (PST) 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 S1350600AbiBKNfH (ORCPT + 93 others); Fri, 11 Feb 2022 08:35:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244799AbiBKNfC (ORCPT ); Fri, 11 Feb 2022 08:35:02 -0500 Received: from mx1.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89BE61E3; Fri, 11 Feb 2022 05:34:59 -0800 (PST) Received: from [192.168.0.7] (ip5f5aebe1.dynamic.kabel-deutschland.de [95.90.235.225]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 3735261EA1927; Fri, 11 Feb 2022 14:34:56 +0100 (CET) Message-ID: <74bc6234-1b95-7a0a-6ee7-b27fb80a12d4@molgen.mpg.de> Date: Fri, 11 Feb 2022 14:34:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH linux-next] video: fbdev: fbmem: fix pointer reference to null device field Content-Language: en-US To: Zhouyi Zhou References: <20220210065824.368355-1-zhouzhouyi@gmail.com> Cc: daniel@ffwll.ch, deller@gmx.de, sam@ravnborg.org, linux@roeck-us.net, willy@infradead.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, paulmck@kernel.org, rcu@vger.kernel.org From: Paul Menzel In-Reply-To: <20220210065824.368355-1-zhouzhouyi@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org Dear Zhouyi, Am 10.02.22 um 07:58 schrieb Zhouyi Zhou: > In function do_remove_conflicting_framebuffers, if device is NULL, there > will be null pointer reference. The patch add a check to the if expression. > > Signed-off-by: Zhouyi Zhou > --- > Dear Linux folks > > I discover this bug in the PowerPC VM provided by > Open source lab of Oregon State University: > > https://lkml.org/lkml/2022/2/8/1145 > > I found that the root cause of null device field is in offb_init_fb: > info = framebuffer_alloc(sizeof(u32) * 16, NULL); > > I have tested the patch in the PowerPC VM. Hope my patch can be correct. > > Many Thanks > Zhouyi > -- > drivers/video/fbdev/core/fbmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c > index 34d6bb1bf82e..422b1fc01722 100644 > --- a/drivers/video/fbdev/core/fbmem.c > +++ b/drivers/video/fbdev/core/fbmem.c > @@ -1579,7 +1579,7 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a, > * If it's not a platform device, at least print a warning. A > * fix would add code to remove the device from the system. > */ > - if (dev_is_platform(device)) { > + if (device && dev_is_platform(device)) { > registered_fb[i]->forced_out = true; > platform_device_unregister(to_platform_device(device)); > } else { Looks reasonable. Acked-by: Paul Menzel Kind regards, Paul PS: Please note, this should be unrelated to my problem though, as I didn’t use linux-next. (Let’s continue in the other thread though.)