Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2104394lkv; Thu, 20 May 2021 03:30:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7rx75VoyfQGeZkGvRydCPYYycCcBsp7cOcZEkLbZC1zSY3+VpShUC3QMCaFXaUeVNMxUx X-Received: by 2002:a02:662b:: with SMTP id k43mr4999417jac.139.1621506644361; Thu, 20 May 2021 03:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621506644; cv=none; d=google.com; s=arc-20160816; b=W1XFeBAhV2u6qEhDPsg/PtIPB+7nT+/H8fBbkLBUQ2uaN2dABVnCUYeaXEoBlKusVF EiTOnxDCZzLKU35bYVqnbqnglAyKcCOqP07bNfQEc1oX5mE1Rbej8tg0FfHWQ4j5R6PG KvTbvc1fBwNn9anE3zr6sa10Dhg4P46o7ofVhF2i9U1CVDrMJbTvXdIJ8wr4z9e/XOiR Rl6B4FUQ0lgMJxujt0P0jOL3HhfusO1uotzMGvesqTGnwkFukMRiCZt9a+k5jeBk8pDt tzNgBTY14nl9eOhfvFfGUfvIauNLubkOkef4kWk0uhb37k7aigLN48ypyaMYLFnoio0/ Vg/w== 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=F7EZ4koo8cugZJNJQpxoFENQEWxHKq4g2Cn5te508jk=; b=dkk/oujXh4ilvgQebd6hf21C6cduL6ieZrYcSlhZXffC6gbK+ov6A96pbofTFW8c+7 mMeUOJnH+rEHEi/c3nz52XEgSx0gs3o3X9bvDpp9FU8oMkElrvWvSrMFVH9wMWf9NrDc 0ev2oDWKG2UVX5AqJB3noid5DWvCIImaYIR2fV56ZDbdZqc14dC+yXw4/QHV0CLqJuNn qOU99DHvbKx4rdmmh6kTSU34qHF2NpGmOeZR/USqaWzG+rdKugrP2uCelCeDS11X2s8X KqAx6Ihfl4VEyu1wXocgwuB3ecrAG0ym6/NrK5XGANPn4W3CGl1PtK7p1K4PDKtPi2SD eCyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RFqbHFEz; 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 z2si2015141jat.35.2021.05.20.03.30.26; Thu, 20 May 2021 03:30:44 -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=RFqbHFEz; 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 S236966AbhETK3V (ORCPT + 99 others); Thu, 20 May 2021 06:29:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:46918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235235AbhETKPj (ORCPT ); Thu, 20 May 2021 06:15:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 43921619B8; Thu, 20 May 2021 09:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503954; bh=hs+EqPyCDyqCDKC+REF6QbabERUgprgunsI+jUv/DwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RFqbHFEzFfR2CpGXKPUySFVyXqALPiwxqna4z9/xzMKRmEYhhBLxSf/XDtLhGoKxE RTPR6SthhW8Kf4rJIupSA141KDpEoT0nAZBX/OZopCPlLPBJVeZroi+kQPTWlOQbAF 9ZHCLZmtVWyCPMKxREBtNCmDT/VBaqMhHUVBSIU4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+47fa9c9c648b765305b9@syzkaller.appspotmail.com, Geert Uytterhoeven , Phillip Potter Subject: [PATCH 4.14 029/323] fbdev: zero-fill colormap in fbcmap.c Date: Thu, 20 May 2021 11:18:41 +0200 Message-Id: <20210520092121.110014320@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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: Phillip Potter commit 19ab233989d0f7ab1de19a036e247afa4a0a1e9c upstream. Use kzalloc() rather than kmalloc() for the dynamically allocated parts of the colormap in fb_alloc_cmap_gfp, to prevent a leak of random kernel data to userspace under certain circumstances. Fixes a KMSAN-found infoleak bug reported by syzbot at: https://syzkaller.appspot.com/bug?id=741578659feabd108ad9e06696f0c1f2e69c4b6e Reported-by: syzbot+47fa9c9c648b765305b9@syzkaller.appspotmail.com Cc: stable Reviewed-by: Geert Uytterhoeven Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20210331220719.1499743-1-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fbcmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/video/fbdev/core/fbcmap.c +++ b/drivers/video/fbdev/core/fbcmap.c @@ -101,17 +101,17 @@ int fb_alloc_cmap_gfp(struct fb_cmap *cm if (!len) return 0; - cmap->red = kmalloc(size, flags); + cmap->red = kzalloc(size, flags); if (!cmap->red) goto fail; - cmap->green = kmalloc(size, flags); + cmap->green = kzalloc(size, flags); if (!cmap->green) goto fail; - cmap->blue = kmalloc(size, flags); + cmap->blue = kzalloc(size, flags); if (!cmap->blue) goto fail; if (transp) { - cmap->transp = kmalloc(size, flags); + cmap->transp = kzalloc(size, flags); if (!cmap->transp) goto fail; } else {