Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3299019pxk; Mon, 21 Sep 2020 10:01:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHhTTiyP2vC/WtlLKGjKViOShEI5DTkpoT+hWb+FSWahaBGHJkSVwj5eTxOzBaIJe3wejq X-Received: by 2002:a05:6402:13d3:: with SMTP id a19mr570592edx.255.1600707710651; Mon, 21 Sep 2020 10:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707710; cv=none; d=google.com; s=arc-20160816; b=ZOVOp+GhbBZ7+7nsvSRrBRPSL+LRYIlqALqNZhWd+xXyi+MrOKl7ng0UolacqJDqLa T6PXy5ahm+ceI+78ginbrOTrq+0ggiNFFtKlkMa9gshpAMYQpOaYDq5iwfMLhAfvFZdM zu9XI4T/70cV2aHK63rDA99UKkYFSXIsO3izeV1qiLL9BbM+UYiGa96D6oV7eJ/IY+lR 5w31J68OQnpAr0f9tohUjJ9StesdLYXN3G0deLRtyHqICSPADBt4vrEtAbkBY6+EPm6D I//D/Z7mNOUiX5ARCqR5xgNHrDGYlYujrpmk2uG5duOH0ySUJE/fHAuMYx3DUcnWjvaV lAiw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sU4ZeMjcpcf/RGS0TjwyZlZFuu+jkAp1wVHx9r5ZcZ4=; b=0zX1GKJX0OumhYbvx71tViKemrQv5frd81YsVamg/1E8jBzKZw3mKbyipQc08GYjjM t1wmutq3bzQl/joEAZWFPS6oA9ngewp3X/1GaH3Ue94WXxKVp+2zj5xyQYZ9dZiAbGLn 8SxjTpnbG8UF12aRSo/rLBWdRgs0KwjG7GmWbZXIpfY6WNXGcEb3CDgCO3dUjtQhkAfJ pUCl1zhsLwwqNm5kOiXK0xAsodIWAgiTpOiuRTPO7caIQ7s1AzVcf4m5JO3XzFhiLBCv 9LEsUHuae47UKXKEPg/LCFjwv69hGDZbSOnz+6AHBxrTziIQtoKW9upR3U7POQe+tH4e 7UOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K+vQhCPE; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk17si8656376ejb.71.2020.09.21.10.01.26; Mon, 21 Sep 2020 10:01:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=K+vQhCPE; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730366AbgIURAb (ORCPT + 99 others); Mon, 21 Sep 2020 13:00:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:42148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729300AbgIUQjv (ORCPT ); Mon, 21 Sep 2020 12:39:51 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D9DE8206DC; Mon, 21 Sep 2020 16:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706390; bh=268MGWFGNSGhF8vkfmMrcswiJWzPyJTIJ6eoxKK2zLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+vQhCPEfIOdTXKbBTE1f/O/NJ7D4VxYfERlQPRZzKu417mSulkRifC9CXoIiTy+5 doAnvscOJcBfCsAB3ghUHbi8yJ6rc0Xe0VEKtRNzTKlBV5lJxNJAdM6Pcww+5wjDBa LA+qUUf7bBwXNDhvdTj9ADoan/Bnvi3mhfgspJE8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , George Kennedy , Sasha Levin Subject: [PATCH 4.14 80/94] fbcon: Fix user font detection test at fbcon_resize(). Date: Mon, 21 Sep 2020 18:28:07 +0200 Message-Id: <20200921162039.200305379@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tetsuo Handa [ Upstream commit ec0972adecb391a8d8650832263a4790f3bfb4df ] syzbot is reporting OOB read at fbcon_resize() [1], for commit 39b3cffb8cf31117 ("fbcon: prevent user font height or width change from causing potential out-of-bounds access") is by error using registered_fb[con2fb_map[vc->vc_num]]->fbcon_par->p->userfont (which was set to non-zero) instead of fb_display[vc->vc_num].userfont (which remains zero for that display). We could remove tricky userfont flag [2], for we can determine it by comparing address of the font data and addresses of built-in font data. But since that commit is failing to fix the original OOB read [3], this patch keeps the change minimal in case we decide to revert altogether. [1] https://syzkaller.appspot.com/bug?id=ebcbbb6576958a496500fee9cf7aa83ea00b5920 [2] https://syzkaller.appspot.com/text?tag=Patch&x=14030853900000 [3] https://syzkaller.appspot.com/bug?id=6fba8c186d97cf1011ab17660e633b1cc4e080c9 Reported-by: syzbot Signed-off-by: Tetsuo Handa Fixes: 39b3cffb8cf31117 ("fbcon: prevent user font height or width change from causing potential out-of-bounds access") Cc: George Kennedy Link: https://lore.kernel.org/r/f6e3e611-8704-1263-d163-f52c906a4f06@I-love.SAKURA.ne.jp Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/video/fbdev/core/fbcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 9f12d8e512aa3..5825f057fb4b1 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -1957,7 +1957,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, struct fb_var_screeninfo var = info->var; int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; - if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) { + if (p->userfont && FNTSIZE(vc->vc_font.data)) { int size; int pitch = PITCH(vc->vc_font.width); -- 2.25.1