From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 427F6241C90 for ; Tue, 18 Feb 2025 14:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739887333; cv=none; b=BrfNlRqqknXYlq0b+6r0AkJNUI8Y0BwIDHLNuHdryAwh1y8RBNW1deFzX5Rv8cWNGZ6/j1goF9z5ykKi1c0td/gqlyI9CkFCuT59PquTy4wTXmne5QBNQZvmA3QBnM4d+CHtqxpUm1SuTKi/Lx88GNDnNTa3var5LVy0KwfqtZU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739887333; c=relaxed/simple; bh=78UtrGyIt1/L+UYHIEJGp2G/7ja10og+LzFCl/Cy1L0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=ZQdhDmver2B1ZVNQNTcLo4zp4VrYEuSTATsw2cJU4KlOgbZmSc54fSw7sQTNwmowK2SHyOBY8OaonLmMKXz0QMyMog73zArnoMyEkQPp+3PMTnKjRrZGmT/I0iEdEhg01e+jHvkrcWjKBF+NkoyRJq9yCFJajrCn7HelQHmzWIk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tDjAjgf2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tDjAjgf2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59048C4CEE6; Tue, 18 Feb 2025 14:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739887332; bh=78UtrGyIt1/L+UYHIEJGp2G/7ja10og+LzFCl/Cy1L0=; h=Subject:To:Cc:From:Date:From; b=tDjAjgf2F4sKpQhAr7nWJ7BbqoSxqbNuvZbsPQKFusQh4V4CwdS3GxphwcsdQjNgS wIH+NXmeAic/q60Q7QwdmNiN/6W6RcCkggg4jXw1+Fjkc5fCShPntbrGXU8tlmLRWe R5guFhXkyMOiM+dfMRWuIPNBY/jiJWAF1d+eDTMM= Subject: FAILED: patch "[PATCH] drm/msm/gem: prevent integer overflow in" failed to apply to 6.6-stable tree To: dan.carpenter@linaro.org,robdclark@chromium.org Cc: From: Date: Tue, 18 Feb 2025 15:02:09 +0100 Message-ID: <2025021809-sixtyfold-showroom-5f4e@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 3a47f4b439beb98e955d501c609dfd12b7836d61 # git commit -s git send-email --to '' --in-reply-to '2025021809-sixtyfold-showroom-5f4e@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 3a47f4b439beb98e955d501c609dfd12b7836d61 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 15 Nov 2024 17:50:08 +0300 Subject: [PATCH] drm/msm/gem: prevent integer overflow in msm_ioctl_gem_submit() The "submit->cmd[i].size" and "submit->cmd[i].offset" variables are u32 values that come from the user via the submit_lookup_cmds() function. This addition could lead to an integer wrapping bug so use size_add() to prevent that. Fixes: 198725337ef1 ("drm/msm: fix cmdstream size check") Cc: stable@vger.kernel.org Signed-off-by: Dan Carpenter Patchwork: https://patchwork.freedesktop.org/patch/624696/ Signed-off-by: Rob Clark diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index fba78193127d..f775638d239a 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -787,8 +787,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, goto out; if (!submit->cmd[i].size || - ((submit->cmd[i].size + submit->cmd[i].offset) > - obj->size / 4)) { + (size_add(submit->cmd[i].size, submit->cmd[i].offset) > obj->size / 4)) { SUBMIT_ERROR(submit, "invalid cmdstream size: %u\n", submit->cmd[i].size * 4); ret = -EINVAL; goto out;