Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp608514pxj; Thu, 20 May 2021 17:44:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTDwTZDLpm4jt/ibQZkEbueahH1lqHsHe2vrh3uyGz4kR1LGwZCMu/W4ETYDAjuHN5KBtA X-Received: by 2002:aa7:d5cf:: with SMTP id d15mr7789967eds.153.1621557873327; Thu, 20 May 2021 17:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621557873; cv=none; d=google.com; s=arc-20160816; b=jMIXD3+iCVW/bwT3qn4502Ph4URRWmMddD6OwtpOYzKRJCd4qvxbXfIgrpp4eS1gqo pKNjUK40jAJd51MRjKIOWN1TpWmEFpNt5dRrZlcrwmGnM56Cnbee4DvI59WBmFAFg5xI gdSqwVWfcYxQrqtDv3CAZVRK+7AjSuJCFSxnfAU1ofMwtsSFPbfpD6ffKcKzU5NU9cFd fcWnccs58XKbuAN+1PyFX9IgSCOLJUzSYBidX3BsiIc8tyZMPa/H9LBE9xRBRftUDI2A jKgvlE2k2L8NAivHorjXtazvj9SxTb7fvihyrOvoQOhqtDkM2zuZfiKnogBgXZ1CqAJD OKKA== 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=XvCMiRhw18dlnYbX6mNDnkArzFdsZ6c6TP5sN4UF1JNaDyzSgbmk++WFMNYnwgNFs0 jAE1daDwl8addrmkX1MUgcJ6GL5dKVE5CHrx10dI3gj+R4GjY+DNpr6Lh7ea9J6TIMMH W45ZxWyhIjQbRNabSAMJTQ6oPPrnN+4ovx+wv0Bo1P3vKhfTDn1cpT9uYmCKUcO5QUXc myEEuDOLBwfkJ7EsZ7a1fqjd2dius98szOwTu0pclsX1cMdMDabdrYEJMGrNmQzt2jmT 1A63LAfwxugVtd+vrvVzE98nY0lqUe53IxpMbXMwEyiw+ekXpu1dGY1LdeMAo5scvVA1 halA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GHe+llIp; 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 ds10si4383939ejc.709.2021.05.20.17.44.09; Thu, 20 May 2021 17:44:33 -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=GHe+llIp; 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 S240866AbhETL2A (ORCPT + 99 others); Thu, 20 May 2021 07:28:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:39636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236335AbhETLIB (ORCPT ); Thu, 20 May 2021 07:08:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E7039613DC; Thu, 20 May 2021 10:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505170; bh=hs+EqPyCDyqCDKC+REF6QbabERUgprgunsI+jUv/DwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHe+llIpmUfrCL7r+a+VcU+HB98SAOccnjxpA62BlxEwjRkJIpTnKMeyvObPWOgc8 1hOD914INSm2h3qHpAArncplFEkM6w8bacUwTzMKh6j2iMcviAJ9YQK11jXXud/4bK SzIrAn8CimC7mDLLmKcA4941+gzmLCXCXKghvJpI= 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.4 014/190] fbdev: zero-fill colormap in fbcmap.c Date: Thu, 20 May 2021 11:21:18 +0200 Message-Id: <20210520092102.645060439@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 {