braice / MuMuDVB

A DVB IPTV streaming software
http://mumudvb.braice.net/
GNU General Public License v2.0
219 stars 133 forks source link

An improper locking bug(e.g., deadlock) on the lock chan_p.lock #274

Closed ycaibb closed 3 years ago

ycaibb commented 3 years ago

Hi, developers, thank you for your checking. It seems the lock chan_p.lock is not released correctly when mumu_init_chan(&chan_p.channels[ichan])<0? https://github.com/braice/MuMuDVB/blob/9c9441896b6393bcb8726f03a2c7c4acd8934693/src/mumudvb.c#L1108-L1114

https://github.com/braice/MuMuDVB/blob/9c9441896b6393bcb8726f03a2c7c4acd8934693/src/mumudvb.c#L1706-L1726

ycaibb commented 3 years ago

Hi, developers @braice @freddy36

Any comments would be highly appreciated. Thank you.

Best Regards,

braice commented 3 years ago

Hello

Can you tell us more about what is the issue you are seeing?

Is it from static analysis or from unexpected behavior that you had identified this potential lock issue?

Thank you

On Tue, Sep 7, 2021, 06:59 ycaibb @.***> wrote:

Hi, developers, thank you for your checking. It seems the lock chan_p.lock is not released correctly when mumu_init_chan(&chan_p.channels[ichan])<0?

https://github.com/braice/MuMuDVB/blob/9c9441896b6393bcb8726f03a2c7c4acd8934693/src/mumudvb.c#L1108-L1114

https://github.com/braice/MuMuDVB/blob/9c9441896b6393bcb8726f03a2c7c4acd8934693/src/mumudvb.c#L1706-L1726

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/braice/MuMuDVB/issues/274, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACRID64FF32PKYAWFT2RXLUAWL3JANCNFSM5DRRQ2CQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ycaibb commented 3 years ago

@braice Hi, it is from a static code scan. The issue is that the lock could chan_p.lock is not correctly released when mumu_init_chan(&chan_p.channels[ichan])<0 and can lead to a lock leak. I manually checked this and found it is a true positive. Can you confirm this bug?

braice commented 3 years ago

Indeed this is possible that it is a true positive If you are comfortable doing so, feel free to propose a fix via a github merge request and I can include it !

Thank you

Brice

On Thu, Sep 9, 2021 at 3:27 PM ycaibb @.***> wrote:

@braice https://github.com/braice Hi, it is from a static code scan. The issue is that the lock could chan_p.lock is not correctly released when mumu_init_chan(&chan_p.channels[ichan])<0 and can lead to a lock leak. I manually checked this and found it is a true positive. Can you confirm this bug?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/braice/MuMuDVB/issues/274#issuecomment-916090893, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACRIDZJR5LR2JLIQKU2JTTUBCY3VANCNFSM5DRRQ2CQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ycaibb commented 3 years ago

@braice I created a PR. Please check.

Thanks~

braice commented 3 years ago

Hello

I'll check it out this weekend

Thank you !

On Sun, Sep 12, 2021 at 5:46 AM ycaibb @.***> wrote:

@braice https://github.com/braice I created a PR. Please check.

Thanks~

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/braice/MuMuDVB/issues/274#issuecomment-917544793, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACRID6VL7MIPWZHOVKOVNDUBQPADANCNFSM5DRRQ2CQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ycaibb commented 3 years ago

Fixed by #275