Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3572624pxv; Mon, 26 Jul 2021 07:07:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXTWjAFn3n0KtpHw42UM4OzgtsXf5JEBrLiGG6zkGIIPW5Qq8iL6vFTLaNhaDL/AWy8kpI X-Received: by 2002:a92:b748:: with SMTP id c8mr13449437ilm.302.1627308425403; Mon, 26 Jul 2021 07:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627308425; cv=none; d=google.com; s=arc-20160816; b=R+f+2wbaQ+7T743Ad1+fNERKHVCIuouWFwDcOyyR70z5uYPFzFDg21sh3KQkc7bhmR oImRpKAPE6OaOYFLRzs7kHIbNc7hQwpunWPI9rvMZvthw+An+TPMiFZqj11fl6LUOhbu 9y+PGn/zguVEZJmYP5/i6UB/VE26WjEAExfrWzrAmy10DWAgUYX/vi9sisdD4q1bVjWv P5IaYZsqltrIofx8qITIBCW335eKSIsAE1sTj0eu/9Lbgh45a0yFeZru8ZWNwcTfk0tk KI8keU20ZuXtjgmT57rDUt8Yvq8wn0ReiHih55Cs/fbEsl+vubdPZuJaCoueNCCL7xDD vObA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ANXX4jBGrA5LFXdU44nFm48hIyFAe+11ml7m5w6JlmQ=; b=EBiy1Gm4JZq7z5JzvfmZS2Trziu+g+vjvXJOuGZS0nOt9vk/olNHcIXH1rURyQDWxF 57JMc8FEIf8O9IiYgtl5sYRrp4t3wBF/USA5if3e5kNaKAcLH1t/V97P3yZCAP9hOU20 gLFEXbrRs1b7TOH1vbat0ud0NDo1iNNSoUyqdLhOy0n7twHCvnFCw5gqcmhsCVcncNok yOyJtkfrjqYMaNPHU0+lXzNpLg6RkgyY0UZfDhwkGM32kgy/eHsI9j0gHEmlkqzjiyvl OLdlkr8E4Uw07ZLPRJ2HUKJie10FLRt8T2+K4Cb+WzxyuspJWGmqsBQaUxVckAFzHb8L 52ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o9aDp1ct; 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=pass (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 r7si36122ill.122.2021.07.26.07.06.51; Mon, 26 Jul 2021 07:07:05 -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=@linuxfoundation.org header.s=korg header.b=o9aDp1ct; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234169AbhGZMUD (ORCPT + 99 others); Mon, 26 Jul 2021 08:20:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:51670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234072AbhGZMUD (ORCPT ); Mon, 26 Jul 2021 08:20:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6E24260EB2; Mon, 26 Jul 2021 13:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627304431; bh=Gx/Vu6b5lzcfCCty2qy4h00ua5IDYhArV6JrOmQxNS8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o9aDp1ctvx10cMjlC0OosTWfFezUbdRDRuQu1+MFYpb8tIhL5aOmRbXZBg1ZeHtO3 riGsjq9UYMhSgJdfLhE0CFvjViQRi2xUL9a42dzMsO6zenIWRF2FDoTmRCZbKhcVZd qnUoC54u7kjQi2h8T2RlDDwYjiy1q4xjHpU81Nng= Date: Mon, 26 Jul 2021 15:00:28 +0200 From: "gregkh@linuxfoundation.org" To: =?utf-8?B?dGNzX2tlcm5lbCjohb7orq/kupHlhoXmoLjlvIDlj5HogIUp?= Cc: "daniel.vetter@ffwll.ch" , "yepeilin.cs@gmail.com" , "penguin-kernel@I-love.SAKURA.ne.jp" , "tzimmermann@suse.de" , "george.kennedy@oracle.com" , "ducheng2@gmail.com" , "sam@ravnborg.org" , "dri-devel@lists.freedesktop.org" , "linux-fbdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] fbcon: Out-Of-Bounds write in sys_imageblit, add range check Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 26, 2021 at 11:32:37AM +0000, tcs_kernel(腾讯云内核开发者) wrote: > yres and vyres can be controlled by user mode paramaters, and cause p->vrows to become a negative value. While this value be passed to real_y function, the ypos will be out of screen range. > This is an out-of-bounds write bug. > > > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c > index 22bb3892f6bd..0970de46782f 100644 > --- a/drivers/video/fbdev/core/fbcon.c > +++ b/drivers/video/fbdev/core/fbcon.c > @@ -1956,11 +1956,12 @@ static void updatescrollmode(struct fbcon_display *p, > int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); > int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, > info->var.xres_virtual); > + int rows = vc->vc_rows; > > p->vrows = vyres/fh; > - if (yres > (fh * (vc->vc_rows + 1))) > - p->vrows -= (yres - (fh * vc->vc_rows)) / fh; > - if ((yres % fh) && (vyres % fh < yres % fh)) > + if ((yres > (fh * (rows + 1))) && (vyres >= (yres - (fh * rows))) && p->vrows) > + p->vrows -= (yres - (fh * rows)) / fh; > + if ((yres % fh) && (vyres % fh < yres % fh) && p->vrows) > p->vrows--; > } > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - Your patch is malformed (tabs converted to spaces, linewrapped, etc.) and can not be applied. Please read the file, Documentation/email-clients.txt in order to fix this. - Your patch does not have a Signed-off-by: line. Please read the kernel file, Documentation/SubmittingPatches and resend it after adding that line. Note, the line needs to be in the body of the email, before the patch, not at the bottom of the patch or in the email signature. - You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot