提交 5cd43371 编写于 作者: P Philipp Zabel

gpu: ipu-cpmem: set image base address even for incorrect formats

Otherwise, if the image base address is kept at zero, and if the user
ignores the error return value, the IPU may be configured to write into
the dma-apbh@00110000 region for large frames, which will lock up the
system.
Reported-by: NRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: NPhilipp Zabel <p.zabel@pengutronix.de>
上级 2e9a7121
...@@ -644,6 +644,7 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image) ...@@ -644,6 +644,7 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
{ {
struct v4l2_pix_format *pix = &image->pix; struct v4l2_pix_format *pix = &image->pix;
int offset, u_offset, v_offset; int offset, u_offset, v_offset;
int ret = 0;
pr_debug("%s: resolution: %dx%d stride: %d\n", pr_debug("%s: resolution: %dx%d stride: %d\n",
__func__, pix->width, pix->height, __func__, pix->width, pix->height,
...@@ -720,13 +721,16 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image) ...@@ -720,13 +721,16 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
image->rect.top * pix->bytesperline; image->rect.top * pix->bytesperline;
break; break;
default: default:
return -EINVAL; /* This should not happen */
WARN_ON(1);
offset = 0;
ret = -EINVAL;
} }
ipu_cpmem_set_buffer(ch, 0, image->phys0 + offset); ipu_cpmem_set_buffer(ch, 0, image->phys0 + offset);
ipu_cpmem_set_buffer(ch, 1, image->phys1 + offset); ipu_cpmem_set_buffer(ch, 1, image->phys1 + offset);
return 0; return ret;
} }
EXPORT_SYMBOL_GPL(ipu_cpmem_set_image); EXPORT_SYMBOL_GPL(ipu_cpmem_set_image);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册