Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp473019iob; Wed, 4 May 2022 00:22:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDn/N8YJMQmAJeXpvBDP6MX+X29kIhxx7i0di1MqbdHwmEjJn6DuLJhUUNwPYe0zAlFlOw X-Received: by 2002:a17:907:1b1b:b0:6e4:7fac:6ce0 with SMTP id mp27-20020a1709071b1b00b006e47fac6ce0mr18964171ejc.617.1651648950509; Wed, 04 May 2022 00:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651648950; cv=none; d=google.com; s=arc-20160816; b=koWaUFBRQno3ve1+Hai/9/91p2F6jfobZrfOUSYB82m2tSwa2/qPJ1ot1TvjZoaPcq 7s+DMSc8lrYAZWO+UolzqEOOaBl0TgEWRBWPGd55iLX3c0GdwJ+jtkIPs+6pYbqZnFyL XSXb7lfy+0f/Wd/k5WkeQvTN/QQf0VmMU+SufLe5j8zxsBERAkNKZAXJcS7092MKZylm rg0v2gGwz8y8c6kkWEHHrUxD7kkBXIabP6c1G7cTtsHeIbPKeboUy/oyDYRY9hpEJw1U fK62FsxMu+aDtuPTowpZOdb2LNfWbGqmddPcw8kvzWw+ZNIrZ+Hkc562+kgb+Ca9vda9 dM5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=Avi++YC8KXmzp+Qk4qV9sWm8T7rfgLH3Hf0948e2pMg=; b=Lj1nE1X45QxI1vdgFnmuKE3ah9T/BlpSoVk8r1YOx8OQEmxD8px5qdcy0F8f8B1pUZ hc7hZ1u2njGqQXD14NgWpVt30eeGDKApVYUKRJV1ADxd5uwEm3tsxWpXf62lmqtkFmdY D/SNA40rZymrWCwL4sxv/ZMR9pTQ6ZJ1cNw5N9A+yydONEhE7WNnhHnCC+eqlX6yXjn0 lK8wqPLwlqJ8dmvsJbO3JTMqpaXR6lJrVFFeYHwGEakc6IOyWETCAT5f7qhxgU0106g/ 8GFTdwzKnF6KWMcMlX7dfN5cDQPNSBbzA8NvzNz8d5AFkQy9hPNjViUukF3ibMURlQvT 0gxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ravnborg.org header.s=rsa1 header.b=qyPvWgeH; dkim=neutral (no key) header.i=@ravnborg.org; 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 f12-20020a170906c08c00b006f3cfd2c84esi16858956ejz.298.2022.05.04.00.22.06; Wed, 04 May 2022 00:22:30 -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; dkim=pass header.i=@ravnborg.org header.s=rsa1 header.b=qyPvWgeH; dkim=neutral (no key) header.i=@ravnborg.org; 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 S240115AbiECRRn (ORCPT + 99 others); Tue, 3 May 2022 13:17:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240106AbiECRRl (ORCPT ); Tue, 3 May 2022 13:17:41 -0400 Received: from mailrelay3-1.pub.mailoutpod1-cph3.one.com (mailrelay3-1.pub.mailoutpod1-cph3.one.com [46.30.210.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4476C1CFF0 for ; Tue, 3 May 2022 10:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=in-reply-to:content-type:mime-version:references:message-id:subject:cc:to: from:date:from; bh=Avi++YC8KXmzp+Qk4qV9sWm8T7rfgLH3Hf0948e2pMg=; b=qyPvWgeHzAGohjsYgc3ZWnjoDbna/uTaQSPPNwSL7xDnNOo1Q47Ji/02OMsMu4qBWHEu6Zw6EoIbG jw/g3SVlX16x2aepkBBJPnyX34OA3DWQ/NihzWddrQ2k6JAs11A18r26Pz9M9qrC0F2qIaNck20Cpi GmHNkHf68ifKepTvMlwvHGH3BbbfSsR5rJoRtbMv4p77iuhMtnZzEFn04JcMVMxW8UMA4i20S7yut7 lluP0zUNnsVO8jjn4GqwUrE+2OrEJ4ApJpRqGSOWM6fEtLEedqtid9gw9e9hb1W0CYtggXCR2QwSiT aQAqFLXvqG4L+NU/1T0Zq8QFqBXzqEQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=in-reply-to:content-type:mime-version:references:message-id:subject:cc:to: from:date:from; bh=Avi++YC8KXmzp+Qk4qV9sWm8T7rfgLH3Hf0948e2pMg=; b=gpVBElcBjr5YuapCgyRAXILEYvPvn0HuaE/FMglLwovc6+K2T5pSF4vgFkN7eX4GMg5X+ovByah0T B2hOLZlBA== X-HalOne-Cookie: 4ebcfbef59c00a5378bef8f3cf6c7ffdddb91d2d X-HalOne-ID: 6ec553c4-cb04-11ec-be6b-d0431ea8bb03 Received: from mailproxy1.cst.dirpod3-cph3.one.com (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 6ec553c4-cb04-11ec-be6b-d0431ea8bb03; Tue, 03 May 2022 17:14:04 +0000 (UTC) Date: Tue, 3 May 2022 19:14:02 +0200 From: Sam Ravnborg To: Javier Martinez Canillas Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Junxiao Chang , dri-devel@lists.freedesktop.org, Maxime Ripard , Thomas Zimmermann Subject: Re: [PATCH] fbdev: Use helper to get fb_info in all file operations Message-ID: References: <20220503164616.663796-1-javierm@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220503164616.663796-1-javierm@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Javier, On Tue, May 03, 2022 at 06:46:16PM +0200, Javier Martinez Canillas wrote: > A reference to the framebuffer device struct fb_info is stored in the file > private data, but this reference could no longer be valid and must not be > accessed directly. Instead, the file_fb_info() accessor function must be > used since it does sanity checking to make sure that the fb_info is valid. > > This can happen for example if the registered framebuffer device is for a > driver that just uses a framebuffer provided by the system firmware. In > that case, the fbdev core would unregister the framebuffer device when a > real video driver is probed and ask to remove conflicting framebuffers. > > Most fbdev file operations already use the helper to get the fb_info but > get_fb_unmapped_area() and fb_deferred_io_fsync() don't. Fix those two. > > Since fb_deferred_io_fsync() is not in fbmem.o, the helper has to be > exported. Rename it and add a fb_ prefix to denote that is public now. > > Reported-by: Junxiao Chang > Signed-off-by: Javier Martinez Canillas > --- > > drivers/video/fbdev/core/fb_defio.c | 5 ++++- > drivers/video/fbdev/core/fbmem.c | 24 +++++++++++++++--------- > include/linux/fb.h | 1 + > 3 files changed, 20 insertions(+), 10 deletions(-) > > diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c > index 842c66b3e33d..ac1c88b3fbb5 100644 > --- a/drivers/video/fbdev/core/fb_defio.c > +++ b/drivers/video/fbdev/core/fb_defio.c > @@ -68,12 +68,15 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf) > > int fb_deferred_io_fsync(struct file *file, loff_t start, loff_t end, int datasync) > { > - struct fb_info *info = file->private_data; > + struct fb_info *info = fb_file_fb_info(file->private_data); This looks wrong. I assume you wanted to write: > + struct fb_info *info = fb_file_fb_info(file); Sam