Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp636259pxr; Mon, 11 Apr 2022 03:20:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyepiVKc/xDHjrCc6wmBBhkeUJDySHWTVjnWtkLmJXEH9sc0BFRM4jfY6wJ31Q9ZZeAwVta X-Received: by 2002:a63:8c5a:0:b0:387:6367:c08a with SMTP id q26-20020a638c5a000000b003876367c08amr25943004pgn.155.1649672416678; Mon, 11 Apr 2022 03:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649672416; cv=none; d=google.com; s=arc-20160816; b=NMtNIOzxTmwvrTRRge4Rj1T5++Mm6GGcuvCxN4nPp6ITH3S9AyNgumVZxEGrnu9nmd T2arupTfwDmE2MdGLQQWKzgbrjEdW5JxORUL767/oupBjXjqN1uUE9gW0RoWDARa66U9 pp9V1LJNdFoWLfG95KpQxdQKcahMzLYktLMQbQKQ7MTVT35Q3EaV0jR3frnfutrLfYhP zH7nuA5QR17JZbt8ReBS087aQr9SknDpPA1YdHENcMQE1uElI8H1mbL6y4dl2jPHLVyU MKkOd5K1y3taQMG20Ev2yNBBHzoqOi5lnr5CNBpm3W6spUs5NrYvLIiQBD0ZBVqo1cPt R2uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:content-transfer-encoding :content-disposition:mime-version:in-reply-to:references:cc :user-agent:date:subject:to:from; bh=/TSAenkx63aisopgSPKw3kEY8TRz9UbBcoZsmSBqrMM=; b=m4f3BfSRENSKev9W6+Fp/ww7R1Dgm+DbXNWhQ2XiEZyLjH8N5xxmrekHdLNSkCSCw/ 4VFdpztt+bb9zAr+JEu9oDnzh4rOpCd+SBaykI0OQk0XcEkBLFgxSLZxhCJH34Y2ZVo1 XsI5faIqjUa1jk+jTqFGJBOSBHimwboYrJ9UhjBGp9gGJX5GfdPkpxU13ahEQYP1ZcyH HyMMkm/50pkwUSJD1JUmOxBEnMzcB4sIAkX3W3QK2h0RvaJ7mbxKuck7+kvIYms2/fHe EU+Fv/9HDjBvCyc6jzwRr8Dl/rH/LbUqaHMIJRtGoaLBW3eGxEwaRJ3e2/zUfDXDs0Lv vv9A== 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 e13-20020a6558cd000000b0038639161a37si8476445pgu.510.2022.04.11.03.20.03; Mon, 11 Apr 2022 03:20:16 -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 S235970AbiDJJEa (ORCPT + 99 others); Sun, 10 Apr 2022 05:04:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233827AbiDJJE1 (ORCPT ); Sun, 10 Apr 2022 05:04:27 -0400 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 300D06BDCD; Sun, 10 Apr 2022 02:02:17 -0700 (PDT) Received: from [192.168.0.2] (chello089173232159.chello.sk [89.173.232.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 7C4207A0310; Sun, 10 Apr 2022 11:02:15 +0200 (CEST) From: Ondrej Zary To: Zheyu Ma Subject: Re: [PATCH 1/7] video: fbdev: i740fb: Error out if 'pixclock' equals zero Date: Sun, 10 Apr 2022 11:02:13 +0200 User-Agent: KMail/1.9.10 Cc: Helge Deller , Linux Fbdev development list , DRI Development , Linux Kernel Mailing List References: <20220404084723.79089-1-zheyuma97@gmail.com> In-Reply-To: X-KMail-QuotePrefix: > MIME-Version: 1.0 Content-Disposition: inline X-Length: 3115 X-UID: 8 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <202204101102.13505.linux@zary.sk> X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 On Friday 08 April 2022 03:58:10 Zheyu Ma wrote: > On Fri, Apr 8, 2022 at 3:50 AM Helge Deller wrote: > > > > On 4/4/22 10:47, Zheyu Ma wrote: > > > The userspace program could pass any values to the driver through > > > ioctl() interface. If the driver doesn't check the value of 'pixclock', > > > it may cause divide error. > > > > > > Fix this by checking whether 'pixclock' is zero in the function > > > i740fb_check_var(). > > > > > > The following log reveals it: > > > > > > divide error: 0000 [#1] PREEMPT SMP KASAN PTI > > > RIP: 0010:i740fb_decode_var drivers/video/fbdev/i740fb.c:444 [inline] > > > RIP: 0010:i740fb_set_par+0x272f/0x3bb0 drivers/video/fbdev/i740fb.c:739 > > > Call Trace: > > > fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1036 > > > do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1112 > > > fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1191 > > > vfs_ioctl fs/ioctl.c:51 [inline] > > > __do_sys_ioctl fs/ioctl.c:874 [inline] > > > > > > Signed-off-by: Zheyu Ma > > > > Hello Zheyu, > > > > I've applied the patches #2-#7 of this series, but left > > out this specific patch (for now). > > As discussed on the mailing list we can try to come up with a > > better fix (to round up the pixclock when it's invalid). > > If not, I will apply this one later. > > I'm also looking forward to a more appropriate patch for this driver! I was not able to reproduce it at first but finally found it: the monitor must be unplugged. If a valid EDID is present, fb_validate_mode() call in i740fb_check_var() will refuse zero pixclock. Haven't found any obvious way to correct zero pixclock value. Most other drivers simply return -EINVAL. > Thanks, > Zheyu Ma > -- Ondrej Zary