Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.3.2.r1.4] msm-jpegdma: Add V4L2_CAP_DEVICE_CAPS to caps #1927

Merged
merged 1 commit into from
Mar 11, 2019

Conversation

ix5
Copy link

@ix5 ix5 commented Mar 4, 2019

See v4l_querycap() in v4l2-ioctl.c
Otherwise the query fails with a crash:

[...]
Bad caps for driver msm_jpegdma, 4200003 0
------------[ cut here ]------------
WARNING: CPU: 1 PID: 23782 at v4l_querycap+0x90/0xd4
Modules linked in:
CPU: 1 PID: 23782 Comm: ExtCamHotPlug Tainted: G W 4.9.154-gb61c5e1840de-dirty #23
Hardware name: SoMC Kagura-ROW (DT)
task  ffffffc037b85e80 task.stack: ffffffc0b7188000
PC is at v4l_querycap+0x90/0xd4
LR is at v4l_querycap+0x90/0xd4
[...]

@jerpelea
Copy link
Collaborator

jerpelea commented Mar 4, 2019

@kholk

@kholk
Copy link
Contributor

kholk commented Mar 7, 2019

So, this thing shouldn't even happen.
Uhm, the v4l_querycap shouldn't get called, especially from an external camera trigger, let alone internal (ISP) ones.

In any case, if we want to solve it like this... let's say that I don't want to tell you that at this point the entire camera_v2 needs basically the same fix....
...but anyway, your fix is wrong.

You want to do something like this:

cap->device_caps = V4L2_CAP_STREAMING |
		V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_CAPTURE;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;

But then obviously, this is something to keep in mind:
If anything is calling querycap to query cap->capabilities or cap->device_caps, then
that thing is expecting a reply containing either of the two bitmasks.
If the userspace code happens to be buggy (which is not that much unlikely), then
major crashes will happen.

Anyway, fix your patch like I said and let's see: if it works, then it .. works :)

See v4l_querycap() in v4l2-ioctl.c
Otherwise the query fails with a crash:

[...]
Bad caps for driver msm_jpegdma, 4200003 0
------------[ cut here ]------------
WARNING: CPU: 1 PID: 23782 at v4l_querycap+0x90/0xd4
Modules linked in:
CPU: 1 PID: 23782 Comm: ExtCamHotPlug Tainted: G W 4.9.154-gb61c5e1840de-dirty sonyxperiadev#23
Hardware name: SoMC Kagura-ROW (DT)
task  ffffffc037b85e80 task.stack: ffffffc0b7188000
PC is at v4l_querycap+0x90/0xd4
LR is at v4l_querycap+0x90/0xd4
[...]

Signed-off-by: ix5 <ix5@users.noreply.github.com>
Signed-off-by: Angelo G. Del Regno <kholk11@gmail.com>
@ix5
Copy link
Author

ix5 commented Mar 7, 2019

Compiled with your suggestion, seems to work ok so far(well it should ofc).
Force-pushed as well.

@ix5 ix5 changed the title [WIP] msm-jpegdma: Add V4L2_CAP_DEVICE_CAPS to caps msm-jpegdma: Add V4L2_CAP_DEVICE_CAPS to caps Mar 7, 2019
@kholk
Copy link
Contributor

kholk commented Mar 8, 2019

Can anyone else please test this on any other legacy platform?

It looks fine to me now, anyway.
Thanks!

@jerpelea jerpelea merged commit 2637f52 into sonyxperiadev:aosp/LE.UM.2.3.2.r1.4 Mar 11, 2019
@ix5 ix5 deleted the querycaps branch March 11, 2019 12:32
radu-v added a commit to radu-v/umbrella-mod that referenced this pull request Nov 14, 2019
radu-v added a commit to radu-v/umbrella-mod that referenced this pull request Nov 16, 2019
radu-v added a commit to radu-v/umbrella-mod that referenced this pull request Nov 18, 2019
radu-v added a commit to resident-nokia/android_kernel_nokia_umbrella that referenced this pull request Nov 20, 2019
@ix5 ix5 changed the title msm-jpegdma: Add V4L2_CAP_DEVICE_CAPS to caps [2.3.2.r1.4] msm-jpegdma: Add V4L2_CAP_DEVICE_CAPS to caps Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants