Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1023601yba; Thu, 4 Apr 2019 02:39:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgPqK4tzdrGyTx+gADL6ju98uJ7NmBNRhLFqWA4tUmLmOfbzXE3WcILGudzw9jwIQg1Jgc X-Received: by 2002:a17:902:7441:: with SMTP id e1mr5195194plt.13.1554370783809; Thu, 04 Apr 2019 02:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370783; cv=none; d=google.com; s=arc-20160816; b=WTwLO5eBh1chc1He07GcxnBKe2cd0FtQzYwmlUJAFMLRUTxMblYP8Vby+nvCyeKR4g enPXQzl7N4O6L/0w8DeqbHp18w8tVpyAa/s7TCx3n6O90U3eMe5rhfBBMR4T/Rs8itOH T7koSSMEnJ7dA1twhJlFfCRZw/PHi/cB0gTmcFFohT67aNSW4x0yYwntxZ2KDnLhQRTJ B91KnSp9msJnYK7dbk7QNIfOlpTkiktEYyr6G7h7mNa4Anl5KeqDnWlj2aWhvpdXrF7t CPR3dhPYT3o/HOGGIOs3iyP6Uy3aj7dClcKadPeXdjWd2wrnPjC/fPNM0Rd8dqiXfFtN okIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JvERhlr0F+eSOLa5lupV0IAEWwtXxpmxrmPRFb2dzEE=; b=lxNh3SmxRBeZoOqbZE5Mr1GbaPYmpXueaKixama7sPbd/zD8agvNncY8kmAw8hj4cm QmEKIioQip1ZYwANzCvQqtoK6hpdsf/qlk4ws4LaQwRwLvixhrJqu9DsGNYIPYisVzgt Eb2OoktAoCiwzHbR8LU/hCMOawhW2YLI3iShGiW1UVguKgv2MPWF2r5XiDa0a+SsUeKf FOiBz0/0ZOFofD0j8qOUyReaXvck6zxfB0D3mWMQMNqLAhAyyjHlfNfyHxZFy9qbJije L7cggBguUUnVGwpdXhjbKKUsMJMWzXs2NmrX62rkXOWvm+PZ6rUdgFkcqbSpwEsAK/E0 muwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1HbBE8Yc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si15385232pgp.446.2019.04.04.02.39.28; Thu, 04 Apr 2019 02:39:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1HbBE8Yc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731495AbfDDJES (ORCPT + 99 others); Thu, 4 Apr 2019 05:04:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:41980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730646AbfDDJEP (ORCPT ); Thu, 4 Apr 2019 05:04:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D2DE82147C; Thu, 4 Apr 2019 09:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368654; bh=CEjMWr6Q8Cdtn5OH+1kS76ZifgJR0JatV5uLD6HRk1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1HbBE8YcINrjlcwTFvZUW4ofGbysJUye3XfQtcQRjYf6eMaNNCmZJTfv0pjTuau31 OzSgApnyfCmSvreirj4N74qPzW+MPyrz2TtM4skkSM56R7NIAzZ/GobL+r//r1D7TR p4n92m/3HI+c9CflFdqrn90iX9XEGmnJAfyuyZD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manfred Schlaegl , Martin Kepplinger , Daniel Vetter , Bartlomiej Zolnierkiewicz , Sasha Levin Subject: [PATCH 4.19 119/187] fbdev: fbmem: fix memory access if logo is bigger than the screen Date: Thu, 4 Apr 2019 10:47:36 +0200 Message-Id: <20190404084608.854117571@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit a5399db139cb3ad9b8502d8b1bd02da9ce0b9df0 ] There is no clipping on the x or y axis for logos larger that the framebuffer size. Therefore: a logo bigger than screen size leads to invalid memory access: [ 1.254664] Backtrace: [ 1.254728] [] (cfb_imageblit) from [] (fb_show_logo+0x620/0x684) [ 1.254763] r10:00000003 r9:00027fd8 r8:c6a40000 r7:c6a36e50 r6:00000000 r5:c06b81e4 [ 1.254774] r4:c6a3e800 [ 1.254810] [] (fb_show_logo) from [] (fbcon_switch+0x3fc/0x46c) [ 1.254842] r10:c6a3e824 r9:c6a3e800 r8:00000000 r7:c6a0c000 r6:c070b014 r5:c6a3e800 [ 1.254852] r4:c6808c00 [ 1.254889] [] (fbcon_switch) from [] (redraw_screen+0xf0/0x1e8) [ 1.254918] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:c070d5a0 r5:00000080 [ 1.254928] r4:c6808c00 [ 1.254961] [] (redraw_screen) from [] (do_bind_con_driver+0x194/0x2e4) [ 1.254991] r9:00000000 r8:00000000 r7:00000014 r6:c070d5a0 r5:c070d5a0 r4:c070d5a0 So prevent displaying a logo bigger than screen size and avoid invalid memory access. Signed-off-by: Manfred Schlaegl Signed-off-by: Martin Kepplinger Cc: Daniel Vetter Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Sasha Levin --- drivers/video/fbdev/core/fbmem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 77cee99fc36c..c48f083d522a 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -427,6 +427,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, { unsigned int x; + if (image->width > info->var.xres || image->height > info->var.yres) + return; + if (rotate == FB_ROTATE_UR) { for (x = 0; x < num && image->dx + image->width <= info->var.xres; -- 2.19.1