Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp492715pxb; Wed, 27 Oct 2021 06:55:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq2nTRe/Xj/jiY9fm1T/C61ZZf3dKY3LwNgN3ctx1j5o+zep+loTVqTgJSrL2bne5eb6Em X-Received: by 2002:a17:90b:380a:: with SMTP id mq10mr5965522pjb.182.1635342932848; Wed, 27 Oct 2021 06:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635342932; cv=none; d=google.com; s=arc-20160816; b=IbnyPj+ya6vENIiuBTWqbw9mfccPueixal1UPYY5+M9DLDQqdZwxjJP1s3s6w34a5p U/43brHU7NYmTjoQ3N8z7HBzBgHVtmgYjk1HpVnHHURMdhZBC0Oaz0CAZIsMzdm+4QB8 YUPxaWJyMzUKOvz5al8Ga60TK1zUIHsAjkeuD7P6a01DMdG7LlM6VBLo+ep1CH+C4pAn MZgCGNfrdU+V76MWXdRttK8GxMJTXqLaR7/l3gOFpSPMOhNFzKjo0/SdrxaIwQPdXNy0 YtegOW2Na46hBRWyxjDGL7KvaSzZPFP/WkL4fw69IuDw+GqbHCRQ6H6USPx7ebPAJVF+ 6oTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date; bh=H2TqbA1pbviSga437clTbaSDgj7G/Y2APrHzZVonEEc=; b=r5v4A+EXakqAM4kr7hG/dE2wfg2vhKgsI5ANMmarpQ5jJ5s2npc7FdAOzVjPXe+zq9 imvZ2u3gfSoAkrKSsqcLkLUuixMi4ODf99dxlkaG2bZrIU9lxlAbArvW5Jm7fm3qT4bH I17IVyPHBfQTrQnJap8GBC9FR+oJdFqCHGjuUJA6W6SNR/48vQRZkBl6CPJi01F34Jxk a5vmKgrvVBKK9PqdaobMAcyZ6ayN84iZVHGzYM/k0e1RmxOQ/w+mIosFBycNMGhVuYQc iaHnI4wu0wRcZ8JkcPd3UcaJ3krkSvHNUriwfo06TzKgSwObF8OCx6Fu0/HoD6/DiSYk x2uQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=tudelft.nl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si100685pfv.230.2021.10.27.06.55.19; Wed, 27 Oct 2021 06:55:32 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=tudelft.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236220AbhJ0A6J (ORCPT + 99 others); Tue, 26 Oct 2021 20:58:09 -0400 Received: from x127130.tudelft.net ([131.180.127.130]:47124 "EHLO djo.tudelft.nl" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232410AbhJ0A6J (ORCPT ); Tue, 26 Oct 2021 20:58:09 -0400 X-Greylist: delayed 357 seconds by postgrey-1.27 at vger.kernel.org; Tue, 26 Oct 2021 20:58:08 EDT Received: by djo.tudelft.nl (Postfix, from userid 2001) id CC9461C42C4; Wed, 27 Oct 2021 02:51:10 +0200 (CEST) Date: Wed, 27 Oct 2021 02:51:10 +0200 From: wim To: "Maciej W. Rozycki" Cc: Greg Kroah-Hartman , "Pavel V. Panteleev" , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, wim Subject: Re: [PATCH] vgacon: Propagate console boot parameters before calling `vc_resize' Message-ID: <20211027005110.GA26354@djo.tudelft.nl> Reply-To: wim@djo.tudelft.nl References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.2 (2019-01-07) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 26, 2021 at 12:26:22AM +0200, Maciej W. Rozycki wrote: > Fix a division by zero in `vgacon_resize' with a backtrace like: > ... > linux-vt-vgacon-init-cell-height-fix.diff > Index: linux-macro-ide-tty/drivers/video/console/vgacon.c > =================================================================== > --- linux-macro-ide-tty.orig/drivers/video/console/vgacon.c > +++ linux-macro-ide-tty/drivers/video/console/vgacon.c > @@ -366,11 +366,17 @@ static void vgacon_init(struct vc_data * > struct uni_pagedir *p; > > /* > - * We cannot be loaded as a module, therefore init is always 1, > - * but vgacon_init can be called more than once, and init will > - * not be 1. > + * We cannot be loaded as a module, therefore init will be 1 > + * if we are the default console, however if we are a fallback > + * console, for example if fbcon has failed registration, then > + * init will be 0, so we need to make sure our boot parameters > + * have been copied to the console structure for vgacon_resize > + * ultimately called by vc_resize. Any subsequent calls to > + * vgacon_init init will have init set to 0 too. > */ > c->vc_can_do_color = vga_can_do_color; > + c->vc_scan_lines = vga_scan_lines; > + c->vc_font.height = c->vc_cell_height = vga_video_font_height; > > /* set dimensions manually if init != 0 since vc_resize() will fail */ > if (init) { > @@ -379,8 +385,6 @@ static void vgacon_init(struct vc_data * > } else > vc_resize(c, vga_video_num_columns, vga_video_num_lines); > > - c->vc_scan_lines = vga_scan_lines; > - c->vc_font.height = c->vc_cell_height = vga_video_font_height; > c->vc_complement_mask = 0x7700; > if (vga_512_chars) > c->vc_hi_font_mask = 0x0800; Just to let you know that the above patch fixes the crashes I experienced. Tried in kernel 4.9.287. The git tree is broken in the sense that it doesn't know the tags v4.9.284, v4.9.285, v4.9.286 and v2.4.287. Wim.