diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2013-01-09 13:09:55 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-05 14:51:58 -0500 |
commit | 031f515b3d303eca80518ed9a71c79ed420b352a (patch) | |
tree | 01529d8275c75b939181759245da312b4f7841d2 /drivers/media/platform/s5p-fimc/fimc-capture.c | |
parent | c6c03915b630c2b4e488be4f21ab46703e31c16b (diff) |
[media] s5p-fimc: Avoid null pointer dereference in fimc_capture_ctrls_create()
With presence of some faults, e.g. caused by wrong platform data or
the device tree structure the IDX_SENSOR entry in the array may be NULL,
so make sure it is not dereferenced then.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/s5p-fimc/fimc-capture.c')
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-capture.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c index df6fc6c7eecd..5ec2f48f7db5 100644 --- a/drivers/media/platform/s5p-fimc/fimc-capture.c +++ b/drivers/media/platform/s5p-fimc/fimc-capture.c | |||
@@ -486,6 +486,7 @@ static struct vb2_ops fimc_capture_qops = { | |||
486 | int fimc_capture_ctrls_create(struct fimc_dev *fimc) | 486 | int fimc_capture_ctrls_create(struct fimc_dev *fimc) |
487 | { | 487 | { |
488 | struct fimc_vid_cap *vid_cap = &fimc->vid_cap; | 488 | struct fimc_vid_cap *vid_cap = &fimc->vid_cap; |
489 | struct v4l2_subdev *sensor = fimc->pipeline.subdevs[IDX_SENSOR]; | ||
489 | int ret; | 490 | int ret; |
490 | 491 | ||
491 | if (WARN_ON(vid_cap->ctx == NULL)) | 492 | if (WARN_ON(vid_cap->ctx == NULL)) |
@@ -494,11 +495,13 @@ int fimc_capture_ctrls_create(struct fimc_dev *fimc) | |||
494 | return 0; | 495 | return 0; |
495 | 496 | ||
496 | ret = fimc_ctrls_create(vid_cap->ctx); | 497 | ret = fimc_ctrls_create(vid_cap->ctx); |
497 | if (ret || vid_cap->user_subdev_api || !vid_cap->ctx->ctrls.ready) | 498 | |
499 | if (ret || vid_cap->user_subdev_api || !sensor || | ||
500 | !vid_cap->ctx->ctrls.ready) | ||
498 | return ret; | 501 | return ret; |
499 | 502 | ||
500 | return v4l2_ctrl_add_handler(&vid_cap->ctx->ctrls.handler, | 503 | return v4l2_ctrl_add_handler(&vid_cap->ctx->ctrls.handler, |
501 | fimc->pipeline.subdevs[IDX_SENSOR]->ctrl_handler, NULL); | 504 | sensor->ctrl_handler, NULL); |
502 | } | 505 | } |
503 | 506 | ||
504 | static int fimc_capture_set_default_format(struct fimc_dev *fimc); | 507 | static int fimc_capture_set_default_format(struct fimc_dev *fimc); |