Skip to contentSkip to conversation

staging: atomisp: fix heap buffer overflow in framebuffer conversion

PATCH In review Soufiane Dani 2 participants 2 messages Feb 10

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 staging: atomisp: fix heap buffer overflow in framebuffer conversion

Validate sizeimage against the allocated frame buffer size before hmm_store() to prevent out-of-bounds write.

---
Changes in v3:
-
-
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Resend with all recipients (v1 only reached sakari and linux-staging)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/staging/media/atomisp/pci/atomisp_cmd.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +5 -0
index 3a4eb4f6d3be..ca7ffc7855ac 100644
@@ -3326,6 +3326,11 @@ atomisp_v4l2_framebuffer_to_css_frame(const struct v4l2_framebuffer *arg,
 		goto err;
 	}
 
+	if (arg->fmt.sizeimage > res->data_bytes) {
+		ret = -EINVAL;
+		goto err;
+	}
+
 	tmp_buf = vmalloc(arg->fmt.sizeimage);
 	if (!tmp_buf) {
 		ret = -ENOMEM;

---
base-commit: 72c395024dac5e215136cbff793455f065603b06
change-id: 20260210-atomisp-fix-8e083f753688

Best regards,

Signature · 1 line
Soufiane Dani <[email protected]>
#1 lore raw
Quoted 7 lines · On Tue, Feb 10, 2026 at 04:45:23PM +0100, Soufiane Dani via B4 Relay wrote:

From: Soufiane Dani <[email protected]>

Validate sizeimage against the allocated frame buffer size before hmm_store() to prevent out-of-bounds write.

---

Same review comments as v1. Please slow down on the resends. There is no need to rush.

regards,
dan carpenter