umlaeute / v4l2loopback

v4l2-loopback device
GNU General Public License v2.0
3.69k stars 523 forks source link

mutex lock access to outbufs_list in vidioc_dqbuf #534

Closed mzihlmann closed 1 year ago

mzihlmann commented 1 year ago

this is the minimal fix that resolves the kernel panic described in the issue. However, its certainly not complete.

closes https://github.com/umlaeute/v4l2loopback/issues/532

mzihlmann commented 1 year ago

i branched off v0.12.7 because HEAD is broken for me, probably related to https://github.com/umlaeute/v4l2loopback/pull/435 https://github.com/umlaeute/v4l2loopback/issues/519 but not yet verified. Because i ran into the other issue i closed the prev. pull request https://github.com/umlaeute/v4l2loopback/pull/533

sanbrother commented 1 year ago

i branched off v0.12.7 because HEAD is broken for me, probably related to #435 #519 but not yet verified. Because i ran into the other issue i closed the prev. pull request #533

I'm sure, the commit ff4e9ee3510109333ace2645ff5b7d1f7edb36d9 introduced a bug. The refactored function is not 100% equal to base code. And, here is the patch

index 1a02f57..9b04506 100644
--- a/v4l2loopback.c
+++ b/v4l2loopback.c
@@ -96,10 +96,10 @@ MODULE_LICENSE("GPL");
 static inline int mod_inc(int *number, int mod)
 {
        int result;
-       result = (*number + 1) % mod;
+       result = (*number) % mod;
        if (unlikely(result < 0))
                result += mod;
-       *number = result;
+       *number = (*number + 1);
        return result;
 }
umlaeute commented 1 year ago

i've accepted #533 instead. thanks.