Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8296bc10 authored by Vladislav Hristov's avatar Vladislav Hristov Committed by Stephen Boyd
Browse files

msm: camera: Prevent using ISPIF when not UP



When ISPIF is not in ISPIF_POWER_UP state, this means that it will not
have register base ioremapped, will not have IRQs reqested and so on. In
this case ISPIF must not be used as it will result in an kernel panic
with the following symptoms:

------------[ cut here ]------------
Unable to handle kernel paging request at virtual address f0d0e248
....
[<c0435738>] (msm_camera_io_w_mb+0x2c/0x44) from [<c044407c>] (msm_ispif_intf_cmd+0x138/0x178)
[<c044407c>] (msm_ispif_intf_cmd+0x138/0x178) from [<c0444f64>] (msm_ispif_subdev_ioctl+0x88c/0x9e0)
[<c0444f64>] (msm_ispif_subdev_ioctl+0x88c/0x9e0) from [<c04648f4>] (subdev_do_ioctl+0x490/0x530)
[<c04648f4>] (subdev_do_ioctl+0x490/0x530) from [<c0459c94>] (video_usercopy+0x360/0x4dc)
[<c0459c94>] (video_usercopy+0x360/0x4dc) from [<c0458edc>] (v4l2_ioctl+0x68/0x114)
[<c0458edc>] (v4l2_ioctl+0x68/0x114) from [<c0154734>] (do_vfs_ioctl+0x4d8/0x54c)
[<c0154734>] (do_vfs_ioctl+0x4d8/0x54c) from [<c01547dc>] (sys_ioctl+0x34/0x54)
[<c01547dc>] (sys_ioctl+0x34/0x54) from [<c000e000>] (ret_fast_syscall+0x0/0x30)
Code: e1a00000 eaffffff e1a00000 e3500000 (e5845000)
---[ end trace 90991692f8caa754 ]---

The above panic can happen when the device have been opened and there
were no ISPIF_INIT cmd, before calling one of the following ISPIF cmds:
  - ISPIF_CFG
  - ISPIF_START_FRAME_BOUNDARY
  - ISPIF_STOP_FRAME_BOUNDARY
  - ISPIF_STOP_IMMEDIATELY

Or there were call to msm_ispif_relese with one of the above commands
called after this.

The only case when the above commands can be issued is between
ISPIF_INIT and ISPIF_RELEASE (or close of the device) calls with
success. In order to prevent usage of the above commands in this
situation, just provide a check for the ISPIF and return -EPERM error
when the ISPIF is not in the correct state.

Change-Id: Ic02794382b301e555a7e9f897ee9c6f67b5818fd
Signed-off-by: default avatarVladislav Hristov <vhrist@codeaurora.org>
parent e3851456
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment