From patchwork Thu Jan 2 22:07:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 234507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2B4DC3276C for ; Thu, 2 Jan 2020 22:56:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B7E4620848 for ; Thu, 2 Jan 2020 22:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578005815; bh=cB4IX+UJzd1OLwcNmkie+J4gIlrd3T4EWRRZqLEQPyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Yt6Ap/ntBKWQmA8HSIEwpUATfvzD1tLeYG7GjBdvKhSnA5DH5cXrvq/oVG/yGwUHY z+hlA5hONDrdYtKyLgcbcpySi0NERHSecWFCamJ1DIUUXylT111RlWhqjzQzmKrATT 7DVZhzionDRXwthQw+6N682w6hqP8ssPRYV/WNfU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728287AbgABW4v (ORCPT ); Thu, 2 Jan 2020 17:56:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:60490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726148AbgABWRo (ORCPT ); Thu, 2 Jan 2020 17:17:44 -0500 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 A8A6422314; Thu, 2 Jan 2020 22:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003464; bh=cB4IX+UJzd1OLwcNmkie+J4gIlrd3T4EWRRZqLEQPyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q8icWJQmSpV9naIY47ALjVsXLTOc9UMKDrWVaJDsj6z4efQgYC7//IpzIwiGkk1fn GxRQKAKdyNFKAU5ikM9WzKC6U3eF/lF8rrClwnxvYwoLLMNWR6K8XOxUeBir7jP8GY KoEqXWAuwrwPPtReR/yCU1BsZ7cz85lMIa9+2tew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , syzbot+fb77e97ebf0612ee6914@syzkaller.appspotmail.com, Kees Cook , Alexander Viro , Stephen Rothwell , Andrew Morton , Linus Torvalds Subject: [PATCH 5.4 145/191] drm: limit to INT_MAX in create_blob ioctl Date: Thu, 2 Jan 2020 23:07:07 +0100 Message-Id: <20200102215845.053049824@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniel Vetter commit 5bf8bec3f4ce044a223c40cbce92590d938f0e9c upstream. The hardened usercpy code is too paranoid ever since commit 6a30afa8c1fb ("uaccess: disallow > INT_MAX copy sizes") Code itself should have been fine as-is. Link: http://lkml.kernel.org/r/20191106164755.31478-1-daniel.vetter@ffwll.ch Signed-off-by: Daniel Vetter Reported-by: syzbot+fb77e97ebf0612ee6914@syzkaller.appspotmail.com Fixes: 6a30afa8c1fb ("uaccess: disallow > INT_MAX copy sizes") Cc: Kees Cook Cc: Alexander Viro Cc: Stephen Rothwell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -561,7 +561,7 @@ drm_property_create_blob(struct drm_devi struct drm_property_blob *blob; int ret; - if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob)) + if (!length || length > INT_MAX - sizeof(struct drm_property_blob)) return ERR_PTR(-EINVAL); blob = kvzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);