Message ID | 20250414-staging-bcm2835-v4l2-fix-v1-1-2b2db9a8f293@raspberrypi.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | staging: bcm2835-camera: Initialise dev in v4l2_dev | expand |
On Mon, Apr 14, 2025 at 06:41:47PM +0100, Dave Stevenson wrote: > Commit 42a2f6664e18 ("staging: vc04_services: Move global g_state to > vchiq_state") changed mmal_init to pass dev->v4l2_dev.dev to > vchiq_mmal_init, however nothing iniitialised dev->v4l2_dev, so we got > a NULL pointer dereference. > > Set dev->v4l2_dev.dev during bcm2835_mmal_probe. The device pointer > could be passed into v4l2_device_register to set it, however that also > has other effects that would need additional changes. > > Fixes: 42a2f6664e18 ("staging: vc04_services: Move global g_state to vchiq_state") > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > --- > Noted as we switched to 6.12 that the driver would fail during probe > with an invalid dereference if a camera module was actually configured > for the legacy camera stack. > https://github.com/raspberrypi/linux/issues/6753 > --- > drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c > index b839b50ac26a..fa7ea4ca4c36 100644 > --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c > +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c > @@ -1900,6 +1900,7 @@ static int bcm2835_mmal_probe(struct vchiq_device *device) > __func__, ret); > goto free_dev; > } > + dev->v4l2_dev.dev = &device->dev; > > /* setup v4l controls */ > ret = bcm2835_mmal_init_controls(dev, &dev->ctrl_handler); > > --- > base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 > change-id: 20250410-staging-bcm2835-v4l2-fix-b8dbd933c23b > > Best regards, > -- > Dave Stevenson <dave.stevenson@raspberrypi.com> > > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot
Am 14.04.25 um 19:41 schrieb Dave Stevenson: > Commit 42a2f6664e18 ("staging: vc04_services: Move global g_state to > vchiq_state") changed mmal_init to pass dev->v4l2_dev.dev to > vchiq_mmal_init, however nothing iniitialised dev->v4l2_dev, so we got > a NULL pointer dereference. > > Set dev->v4l2_dev.dev during bcm2835_mmal_probe. The device pointer > could be passed into v4l2_device_register to set it, however that also > has other effects that would need additional changes. > > Fixes: 42a2f6664e18 ("staging: vc04_services: Move global g_state to vchiq_state") > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > --- > Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index b839b50ac26a..fa7ea4ca4c36 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -1900,6 +1900,7 @@ static int bcm2835_mmal_probe(struct vchiq_device *device) __func__, ret); goto free_dev; } + dev->v4l2_dev.dev = &device->dev; /* setup v4l controls */ ret = bcm2835_mmal_init_controls(dev, &dev->ctrl_handler);
Commit 42a2f6664e18 ("staging: vc04_services: Move global g_state to vchiq_state") changed mmal_init to pass dev->v4l2_dev.dev to vchiq_mmal_init, however nothing iniitialised dev->v4l2_dev, so we got a NULL pointer dereference. Set dev->v4l2_dev.dev during bcm2835_mmal_probe. The device pointer could be passed into v4l2_device_register to set it, however that also has other effects that would need additional changes. Fixes: 42a2f6664e18 ("staging: vc04_services: Move global g_state to vchiq_state") Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> --- Noted as we switched to 6.12 that the driver would fail during probe with an invalid dereference if a camera module was actually configured for the legacy camera stack. https://github.com/raspberrypi/linux/issues/6753 --- drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 1 + 1 file changed, 1 insertion(+) --- base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 change-id: 20250410-staging-bcm2835-v4l2-fix-b8dbd933c23b Best regards,