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 4C49E280CC1; Tue, 17 Feb 2026 20:54:10 +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=1771361650; cv=none; b=PQD/szxFx8Z8jgtuuVlywg6w+SA510tjs1LtXZ1vv9L4kH7ifkNnkUz+ek1qDOMnMmqVsW2CwAc4sCEOOp5tRJd951ZWDJzB21+PqbFOUqh+KmTNVQoW9UoTzizgpBhWNyaAUkPudk+xT7IUL2RMdRrnB8EzilF/SllLLLi0Te4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771361650; c=relaxed/simple; bh=SXs1wJoq+PUI/03r4/27zvILJ8jSFBLWj+5o30om4pw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vD3BJ64oC4P7/LiyV3Emzw7Z0Ddlf67hMrXctoRfevXMzmuF4jbcaANxTQIqQAMuLWgMFfnDUzPY2VaofWGsr9Df5Dx5Bx+n6F9bf+EaK41zsNFL6hPRzgERkNCETlT8JLgL9yldM00e0VDm7J32wJ1Ev2ujY9bYsSS6V45I31o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xpnMT6Tt; 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="xpnMT6Tt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9C5AC4CEF7; Tue, 17 Feb 2026 20:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1771361650; bh=SXs1wJoq+PUI/03r4/27zvILJ8jSFBLWj+5o30om4pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xpnMT6TtIAVZ5Z4/veVPG+heaUPNpob2FfOhXQ1fStLm6ehGoYLQ6e+Yotk0hmX8G lqc5iiAwFk4vgx4OGhpe/fxrOAbXGheQqK1g+WxRI1Hzu3dIemvzu6HLZlLaLz52Lq U4y2eKTT1wO1zDxe33atQnpVFuWa4AuNprK1d8qk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tianchu Chen , stable , Steve Glendinning , Helge Deller Subject: [PATCH 6.12 34/42] fbdev: smscufx: properly copy ioctl memory to kernelspace Date: Tue, 17 Feb 2026 21:32:25 +0100 Message-ID: <20260217200007.306007673@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260217200005.998240758@linuxfoundation.org> References: <20260217200005.998240758@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kroah-Hartman commit 120adae7b42faa641179270c067864544a50ab69 upstream. The UFX_IOCTL_REPORT_DAMAGE ioctl does not properly copy data from userspace to kernelspace, and instead directly references the memory, which can cause problems if invalid data is passed from userspace. Fix this all up by correctly copying the memory before accessing it within the kernel. Reported-by: Tianchu Chen Cc: stable Cc: Steve Glendinning Cc: Helge Deller Signed-off-by: Greg Kroah-Hartman Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/smscufx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -932,7 +932,6 @@ static int ufx_ops_ioctl(struct fb_info unsigned long arg) { struct ufx_data *dev = info->par; - struct dloarea *area = NULL; if (!atomic_read(&dev->usb_active)) return 0; @@ -947,6 +946,10 @@ static int ufx_ops_ioctl(struct fb_info /* TODO: Help propose a standard fb.h ioctl to report mmap damage */ if (cmd == UFX_IOCTL_REPORT_DAMAGE) { + struct dloarea *area __free(kfree) = kmalloc(sizeof(*area), GFP_KERNEL); + if (!area) + return -ENOMEM; + /* If we have a damage-aware client, turn fb_defio "off" * To avoid perf imact of unnecessary page fault handling. * Done by resetting the delay for this fb_info to a very @@ -956,7 +959,8 @@ static int ufx_ops_ioctl(struct fb_info if (info->fbdefio) info->fbdefio->delay = UFX_DEFIO_WRITE_DISABLE; - area = (struct dloarea *)arg; + if (copy_from_user(area, (u8 __user *)arg, sizeof(*area))) + return -EFAULT; if (area->x < 0) area->x = 0;