Message ID | 20250408025725.1244-3-ming.qian@oss.nxp.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | media: imx-jpeg: Fix some motion-jpeg decoding issues | expand |
On Tue, Apr 08, 2025 at 10:57:18AM +0800, ming.qian@oss.nxp.com wrote: > From: Ming Qian <ming.qian@oss.nxp.com> > > When allocation failures are not cleaned up by the driver, further > allocation errors will be false-positives, which will cause buffers to > remain uninitialized and cause NULL pointer dereferences. ... > Clean up the errors accordingly. Ensure proper cleanup of failed allocations to prevent these issues. > > Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") > Signed-off-by: Ming Qian <ming.qian@oss.nxp.com> > Reviewed-by: Frank Li <Frank.Li@nxp.com> > --- > v3 > - Split the moving of code into a separate patch > > v2 > - Add the Fixes tag > > drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c > index b2f7e9ad1885..12661c177f5a 100644 > --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c > +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c > @@ -820,6 +820,7 @@ static bool mxc_jpeg_alloc_slot_data(struct mxc_jpeg_dev *jpeg) > return true; > err: > dev_err(jpeg->dev, "Could not allocate descriptors for slot %d", jpeg->slot_data.slot); > + mxc_jpeg_free_slot_data(jpeg); > > return false; > } > -- > 2.43.0-rc1 >
diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index b2f7e9ad1885..12661c177f5a 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -820,6 +820,7 @@ static bool mxc_jpeg_alloc_slot_data(struct mxc_jpeg_dev *jpeg) return true; err: dev_err(jpeg->dev, "Could not allocate descriptors for slot %d", jpeg->slot_data.slot); + mxc_jpeg_free_slot_data(jpeg); return false; }