Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3415194pxb; Mon, 30 Aug 2021 01:17:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtKSWGk5Wa5CEmmT8TqPqA+49j3muFNaXNxIxeHeW3oLRUpwXRGgF/J/9aB4sGgM9waOpv X-Received: by 2002:a92:3f0b:: with SMTP id m11mr16000425ila.265.1630311465046; Mon, 30 Aug 2021 01:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630311465; cv=none; d=google.com; s=arc-20160816; b=cgUeQ9d6lrCfcyyise7tfxuQCvrirvfgYSzXD9PN7sVdkyvSLiQMC5n7VprRyNH5Fy tBrGFDoo5EbT6nyAMy8m2RYSSMUx/EISOEWwDdBuzz+jcz+oTRYOLIu0y7/ZQwcvjjtt lkivgictIcBXqyt1amZ+ZlypjZuD3IeZl31dN2KhgFbr6fIcaEBbyiPQhJOmzmwwayma 1ozFrOj8n04+cIbEK4xx5PMUf7ZVp5k8OBII0EvuCCIZWS4YKodR9NN9KeCa00sdIIr9 apz0si4eiEUjdwqfpAk6HPGue+oihk2GEPVt7Z8OS7HdpsiMUUdmfxffQS2/oOlKhsXx b55g== 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:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=4V8zQGj1Gqf1F2tUDyAxGYR3CqJxPsTeRp5ZOBqSIDQ=; b=yVzOLyD1gpN1xOYdTeEvhoKlmj6ydqKenl1NW/DeJ/4o0SIvwUG8zb7B/8CkXkZNRl 9fbajdwDqPgcBjDRAdCGYfjly/2o9moe4NLUk8Hy6j52gnoxcUvbuSQkACzZKdf0AMCZ whKZqwlt1lOnAFUMeBc3M1evDLVhQUZ0+MwOWNRzbGGl2L+nXU2Sk74R2gjMZkSJt3TF fECdJwQNj+OUZQhvGz8d5SoGOKzudWSOh/0PiPnbX8bz36dtyfsIWGrz3sKGDSQrGW3R CmuApgQh4DLN8B47RGpGKjxDttXiuVRzzo5Fx2rWV0zb+cCIGZ2YtGw0eEVmWpnGc6OO 0J9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=TuRY2sKW; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si13980519ilb.36.2021.08.30.01.17.33; Mon, 30 Aug 2021 01:17:45 -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=@ffwll.ch header.s=google header.b=TuRY2sKW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234766AbhH3IRV (ORCPT + 99 others); Mon, 30 Aug 2021 04:17:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234764AbhH3IRU (ORCPT ); Mon, 30 Aug 2021 04:17:20 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6F8DC06175F for ; Mon, 30 Aug 2021 01:16:26 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id d6so20367524edt.7 for ; Mon, 30 Aug 2021 01:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=4V8zQGj1Gqf1F2tUDyAxGYR3CqJxPsTeRp5ZOBqSIDQ=; b=TuRY2sKW4BSfhJDjqVGbNRktK9LKQd2XLWSD40j4bkwxZWVIoWgb227dKGlbXTtTY5 AEV0TuIGQPvrFZ6iy4MYEhgyGjzIMrilibmAUyqrwhDs4+AVxXMienXkDEGlpbaRnTFh hTFf9cDd5j+dozZN/drbUiSS0HawPZce23FDc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=4V8zQGj1Gqf1F2tUDyAxGYR3CqJxPsTeRp5ZOBqSIDQ=; b=Ykh0XiQ6x8hN50mlFUfEngwyG7nfvVDA9wcYijEnaknP2yrRsGeYpj2RvjN9v55uYv JGsRTKe7wB3pcoj0duv8O62F8vBsAjrvAzW8Zd4QcTg/AIswqjoKnPoDgIQQ3pMYCaET sOOl+irQBGdupeahJH0RxNGLa1krIci+R2nwEf2TD1/I9TGFfrfxBfj0h/DwYMurQNha lK485FGFYHjkDII1wu8hyEZVA6pD+IctJoRRYEsnOV/szvN+ObmalFymQrKo6G4gJlPH llRlnctq2P/QvRWqgtmlm1f9CHzhhH0zlNgQTkrgLs3lMurnX1Hm81ilxa/owozQReNM syaw== X-Gm-Message-State: AOAM531cy8qSbZwr5KbdwT02C8iiHULpw+gFodpV8VYkdVV2nK6JkuyA kBdbvFV9/GPiVW+oW6IAZ7ckvg== X-Received: by 2002:a50:998f:: with SMTP id m15mr22603150edb.193.1630311385540; Mon, 30 Aug 2021 01:16:25 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id q5sm7275049edt.50.2021.08.30.01.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 01:16:25 -0700 (PDT) Date: Mon, 30 Aug 2021 10:16:14 +0200 From: Daniel Vetter To: tcs.kernel@gmail.com Cc: daniel.vetter@ffwll.ch, willy@infradead.org, george.kennedy@oracle.com, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org, penguin-kernel@i-love.sakura.ne.jp, Haimin Zhang Subject: Re: [PATCH V4] fbcon: fix fbcon out-of-bounds write in sys_imageblit Message-ID: Mail-Followup-To: tcs.kernel@gmail.com, willy@infradead.org, george.kennedy@oracle.com, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org, penguin-kernel@i-love.sakura.ne.jp, Haimin Zhang References: <1630294223-7225-1-git-send-email-tcs_kernel@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1630294223-7225-1-git-send-email-tcs_kernel@tencent.com> X-Operating-System: Linux phenom 5.10.0-8-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 30, 2021 at 11:30:23AM +0800, tcs.kernel@gmail.com wrote: > From: Haimin Zhang > > yres and vyres can be controlled by user mode parameters, 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. > some driver will check xres and yres in fb_check_var callback,but some not > so we add a common check after that callback. > > Signed-off-by: Haimin Zhang > Signed-off-by: Tetsuo Handa Does this fix a syzbot crash or how was this discovered? -Daniel > --- > drivers/video/fbdev/core/fbmem.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c > index 1c85514..5599372 100644 > --- a/drivers/video/fbdev/core/fbmem.c > +++ b/drivers/video/fbdev/core/fbmem.c > @@ -1013,6 +1013,10 @@ static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, > if (ret) > return ret; > > + /* virtual resolution cannot be smaller than visible resolution. */ > + if (var->yres_virtual < var->yres || var->xres_virtual < var->xres) > + return -EINVAL; > + > if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) > return 0; > > -- > 1.8.3.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch