Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2472592pxj; Mon, 10 May 2021 03:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysJbzBqwb0CKM72ee0QXBrJ3eBn8Nb1Q9uHnv6CTLJnQSq1lBte7dGVB0E1V/kHLVZkw0d X-Received: by 2002:a02:c908:: with SMTP id t8mr21177060jao.78.1620644259423; Mon, 10 May 2021 03:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644259; cv=none; d=google.com; s=arc-20160816; b=QLxpZh389ln0GzdmKCeAykaU4CP8npjU2bKbJ/OfKR9mMotD8HG/NfjWIML0XRB9Zs Kj+a7K+KPowDpIf7EVZ4nTSVNRxZRQU5vB9O/hvW5HvqAd9sohOPBHhx6TSsSn9ctaYE tt6kbFRc03RKoILUMCz5SgPhr0JrnEJE0KOvQEmuBGn9T25LFxMrLjEsw7sbThRWv0t5 Fmc6SqPPTIT1A920m+wofAjffsOHItzO2P/nOAjm/afCAkvWBj6B3Hey7rAab6plOk6u pLcsaPMQfowharUSPwIObn7HC3ZXQHVAPTTSm3nX5Kd/5JdHWCpi0bW3P/IRC2dAjNPr YTXw== 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=RYnyWGBsAN6uuHIvkp0u5Z1YuPJ46MWazG/f8LJznmRWCMSDywv2rzqTgfBjPE/Yws oMNK5PDoyf4V5Himj7yoZ6GpL8E8QGhbIIPYe4SDXPpNsbc4JkjmPQ7dTDhNkBUo+78c JjKHDJNIruUFO+o7dEeHy41/uWrQYYjQfAEdlT8b/09aqV0HM20CGacipGgL/ijEJXEw LxcYoihK+9Zag1CFkeInhuQkkwsyn3wkG6OGG9C0UVrQlHK2oIg5PDzsLiyvjfciBqBh r6VyUtkCnETSrs7GnSG/a+K59wsLmeJ/O4zCcucWNAEeknLtQWI2i/2HbhFLkQ+ziapy BdZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nf17fnPL; 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 h10si16192206ioe.38.2021.05.10.03.57.27; Mon, 10 May 2021 03:57:39 -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=nf17fnPL; 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 S234295AbhEJK4J (ORCPT + 99 others); Mon, 10 May 2021 06:56:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:59640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232974AbhEJKox (ORCPT ); Mon, 10 May 2021 06:44:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EDBD46198C; Mon, 10 May 2021 10:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642865; bh=hs+EqPyCDyqCDKC+REF6QbabERUgprgunsI+jUv/DwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nf17fnPL5fsFpTgiv588Hzpys5oFV84o5WbHCvV3fNnFg4qtXrrE6GR0grHD10mvh bAo8A2POwbG33lDrBBIZLQSP5fuT7MVkQam1NgJ2JQoF5qu+67xgr0LDNBWaF9CpX9 7Q6bmAXkXzBNZ1iTo5jaKYxhbGygIuRoY8bqQQME= 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 5.10 049/299] fbdev: zero-fill colormap in fbcmap.c Date: Mon, 10 May 2021 12:17:26 +0200 Message-Id: <20210510102006.489463381@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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 {