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 F394025A650 for ; Tue, 18 Feb 2025 14:02:16 +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=1739887337; cv=none; b=TCKoJSoS4Al8JqSyUdcI8HrKKYBaFiWjNgUDhtlz2Sq6CFUVasQn1zwoON15fqt6KtvOW2t9l+Rk+yAfYwopVLsYprTt6tTDp0+5rstjRjUolPzZ4zZYTZz5jBUR6hZxNLq5KzwTPNmFBG8Frx5wsTf8UbOkx5m8oHYlt5zABE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739887337; c=relaxed/simple; bh=a/aOopdzUornqZYLnd5TIVpgOcisNQYZEbAeUgu/BZ0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=fjkFULbQVm8NE++s2pftBc35xyMJEJYSGIUsexNloScZeYVwXpE1rb4tvzvzxrTGLJpsGIOMQMsfh02e5hzF5FH4DuDNf0yHPmSR6ytvyKL/NjARBxPgOLAzXkM6H87bzb86IiZXRLrjvQLwPSkiiWPRigqAKFjJ6i3fz5Y5PGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=we9xycRh; 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="we9xycRh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16B8EC4CEE2; Tue, 18 Feb 2025 14:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739887336; bh=a/aOopdzUornqZYLnd5TIVpgOcisNQYZEbAeUgu/BZ0=; h=Subject:To:Cc:From:Date:From; b=we9xycRh9s+McC59uiYLf17U3PY/lMuQ/duQi4zPegtVPi85ymWbtaq3Jg0BKwofe e3Nbn0Dc5sJ3RIG1y8DPgKoXesPzrvYhInNTOsQHRIZfJG1kZ44OUYw0Dm0ODwOL6a tuo6+01zVVdhgc2kLb7pQQU6TO/g8gZbOmmUTn9o= Subject: FAILED: patch "[PATCH] drm/msm/gem: prevent integer overflow in" failed to apply to 6.1-stable tree To: dan.carpenter@linaro.org,robdclark@chromium.org Cc: From: Date: Tue, 18 Feb 2025 15:02:11 +0100 Message-ID: <2025021811-coauthor-gosling-ff49@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.1-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.1.y git checkout FETCH_HEAD git cherry-pick -x 3a47f4b439beb98e955d501c609dfd12b7836d61 # git commit -s git send-email --to '' --in-reply-to '2025021811-coauthor-gosling-ff49@gregkh' --subject-prefix 'PATCH 6.1.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;