* [libdvben50221] stack leaks resources on non-MMI session reconnect
@ 2010-07-15 13:20 Stephan Trebels
2010-08-08 21:53 ` DUBOST Brice
0 siblings, 1 reply; 6+ messages in thread
From: Stephan Trebels @ 2010-07-15 13:20 UTC (permalink / raw)
To: linux-media; +Cc: stephan
[-- Attachment #1.1: Type: text/plain, Size: 868 bytes --]
The issue was, that LIBDVBEN50221 did not allow a CAM to re-establish
the session holding non-MMI resources if using the lowlevel interface.
The session_number was recorded on open, but not freed on close (which
IMO is an bug in the code, I attach the scaled down hg changeset). With
this change, the SMIT CAM with a showtime card works fine according to
tests so far.
The effect was, that the CAM tried to constantly close and re-open the
session and the LIBDVBEN50221 kept telling it, that the resource is
already allocated to a different session. Additionally this caused the
library to use the _old_ session number in communications with the CAM,
which did not even exist anymore, so caused all writes of CA PMTs to
fail with EINTR.
Stephan
P.S. If there is a better place to report user-space library bugs for
linuxtv, please let me know.
[-- Attachment #1.2: dvb-apps-ca-session-leak.changeset --]
[-- Type: text/plain, Size: 1450 bytes --]
# HG changeset patch
# User Stephan Trebels <stephan@trebels.com>
# Date 1279192697 -3600
# Node ID 12928658e57ea046b35dfab485f23559b3036d42
# Parent 4ba933ff13fbd619be9bdbbf097b8dbfe0fbf679
Correctly free resources when a session is closed. This allows a CAM module to re-open a session.
diff -r 4ba933ff13fb -r 12928658e57e lib/libdvben50221/en50221_stdcam_llci.c
--- a/lib/libdvben50221/en50221_stdcam_llci.c Sat Jul 03 15:25:16 2010 +0200
+++ b/lib/libdvben50221/en50221_stdcam_llci.c Thu Jul 15 12:18:17 2010 +0100
@@ -374,14 +374,21 @@
} else if (resource_id == EN50221_APP_MMI_RESOURCEID) {
llci->stdcam.mmi_session_number = session_number;
}
+ break;
+ case S_SCALLBACK_REASON_CLOSE:
+ if (resource_id == EN50221_APP_MMI_RESOURCEID) {
+ llci->stdcam.mmi_session_number = -1;
+ } else if (resource_id == EN50221_APP_DATETIME_RESOURCEID) {
+ llci->datetime_session_number = -1;
+ } else if (resource_id == EN50221_APP_AI_RESOURCEID) {
+ llci->stdcam.ai_session_number = -1;
+ } else if (resource_id == EN50221_APP_CA_RESOURCEID) {
+ llci->stdcam.ca_session_number = -1;
+ } else if (resource_id == EN50221_APP_MMI_RESOURCEID) {
+ llci->stdcam.mmi_session_number = -1;
+ }
break;
- case S_SCALLBACK_REASON_CLOSE:
- if (resource_id == EN50221_APP_MMI_RESOURCEID) {
- llci->stdcam.mmi_session_number = -1;
- }
-
- break;
}
return 0;
}
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libdvben50221] stack leaks resources on non-MMI session reconnect.
2010-07-15 13:20 [libdvben50221] stack leaks resources on non-MMI session reconnect Stephan Trebels
@ 2010-08-08 21:53 ` DUBOST Brice
2010-11-02 10:15 ` DUBOST Brice
0 siblings, 1 reply; 6+ messages in thread
From: DUBOST Brice @ 2010-08-08 21:53 UTC (permalink / raw)
To: Stephan Trebels; +Cc: linux-media, adq_dvb
On 15/07/2010 15:20, Stephan Trebels wrote:
>
> The issue was, that LIBDVBEN50221 did not allow a CAM to re-establish
> the session holding non-MMI resources if using the lowlevel interface.
> The session_number was recorded on open, but not freed on close (which
> IMO is an bug in the code, I attach the scaled down hg changeset). With
> this change, the SMIT CAM with a showtime card works fine according to
> tests so far.
>
> The effect was, that the CAM tried to constantly close and re-open the
> session and the LIBDVBEN50221 kept telling it, that the resource is
> already allocated to a different session. Additionally this caused the
> library to use the _old_ session number in communications with the CAM,
> which did not even exist anymore, so caused all writes of CA PMTs to
> fail with EINTR.
>
> Stephan
>
Hello
Just to inform that this patch solves problems with CAM PowerCAM v4.3,
so I think it can interest more people.
Before gnutv -cammenu (and other applications using libdvben50221) was
returning ti;eout (-3) errors constantly after the display of the system
IDs.
Now, the menu is working flawlessly
I cannot test the descrambling for the moment but it improved quite a
lot the situation (communication with th CAM is now possible).
One note concerning the patch itself, the last "else if (resource_id ==
EN50221_APP_MMI_RESOURCEID)" is useless.
Best regards
--
Brice
A: Yes.
>Q: Are you sure?
>>A: Because it reverses the logical flow of conversation.
>>>Q: Why is top posting annoying in email?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libdvben50221] stack leaks resources on non-MMI session reconnect.
2010-08-08 21:53 ` DUBOST Brice
@ 2010-11-02 10:15 ` DUBOST Brice
2010-11-02 10:38 ` Stephan Trebels
0 siblings, 1 reply; 6+ messages in thread
From: DUBOST Brice @ 2010-11-02 10:15 UTC (permalink / raw)
To: Stephan Trebels; +Cc: linux-media, adq_dvb
On 08/08/2010 23:53, DUBOST Brice wrote:
> On 15/07/2010 15:20, Stephan Trebels wrote:
>>
>> The issue was, that LIBDVBEN50221 did not allow a CAM to re-establish
>> the session holding non-MMI resources if using the lowlevel interface.
>> The session_number was recorded on open, but not freed on close (which
>> IMO is an bug in the code, I attach the scaled down hg changeset). With
>> this change, the SMIT CAM with a showtime card works fine according to
>> tests so far.
>>
>> The effect was, that the CAM tried to constantly close and re-open the
>> session and the LIBDVBEN50221 kept telling it, that the resource is
>> already allocated to a different session. Additionally this caused the
>> library to use the _old_ session number in communications with the CAM,
>> which did not even exist anymore, so caused all writes of CA PMTs to
>> fail with EINTR.
>>
>> Stephan
>>
>
> Hello
>
> Just to inform that this patch solves problems with CAM PowerCAM v4.3,
> so I think it can interest more people.
>
> Before gnutv -cammenu (and other applications using libdvben50221) was
> returning ti;eout (-3) errors constantly after the display of the system
> IDs.
>
> Now, the menu is working flawlessly
>
> I cannot test the descrambling for the moment but it improved quite a
> lot the situation (communication with th CAM is now possible).
>
> One note concerning the patch itself, the last "else if (resource_id ==
> EN50221_APP_MMI_RESOURCEID)" is useless.
>
> Best regards
>
>
Hello
After more testing this Patches allow several CAM models to work and
don't seem to make any regression.
Is there anything to be improved/tested for having it included upstream ?
Thank you
Regards
--
Brice
A: Yes.
>Q: Are you sure?
>>A: Because it reverses the logical flow of conversation.
>>>Q: Why is top posting annoying in email?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libdvben50221] stack leaks resources on non-MMI session reconnect.
2010-11-02 10:15 ` DUBOST Brice
@ 2010-11-02 10:38 ` Stephan Trebels
2010-11-02 16:18 ` pierre.gronlier
0 siblings, 1 reply; 6+ messages in thread
From: Stephan Trebels @ 2010-11-02 10:38 UTC (permalink / raw)
To: DUBOST Brice; +Cc: stephan, linux-media, adq_dvb
[-- Attachment #1: Type: text/plain, Size: 2170 bytes --]
Hi Brice,
I did not find more things to be changed, and it works fine for me now.
Given, that the responsiveness on this list is a bit underwhelming, I
wonder whether we can find someone with commit privileges, to push this
change.
Stephan
On Tue, 2010-11-02 at 11:15 +0100, DUBOST Brice wrote:
> On 08/08/2010 23:53, DUBOST Brice wrote:
> > On 15/07/2010 15:20, Stephan Trebels wrote:
> >>
> >> The issue was, that LIBDVBEN50221 did not allow a CAM to re-establish
> >> the session holding non-MMI resources if using the lowlevel interface.
> >> The session_number was recorded on open, but not freed on close (which
> >> IMO is an bug in the code, I attach the scaled down hg changeset). With
> >> this change, the SMIT CAM with a showtime card works fine according to
> >> tests so far.
> >>
> >> The effect was, that the CAM tried to constantly close and re-open the
> >> session and the LIBDVBEN50221 kept telling it, that the resource is
> >> already allocated to a different session. Additionally this caused the
> >> library to use the _old_ session number in communications with the CAM,
> >> which did not even exist anymore, so caused all writes of CA PMTs to
> >> fail with EINTR.
> >>
> >> Stephan
> >>
> >
> > Hello
> >
> > Just to inform that this patch solves problems with CAM PowerCAM v4.3,
> > so I think it can interest more people.
> >
> > Before gnutv -cammenu (and other applications using libdvben50221) was
> > returning ti;eout (-3) errors constantly after the display of the system
> > IDs.
> >
> > Now, the menu is working flawlessly
> >
> > I cannot test the descrambling for the moment but it improved quite a
> > lot the situation (communication with th CAM is now possible).
> >
> > One note concerning the patch itself, the last "else if (resource_id ==
> > EN50221_APP_MMI_RESOURCEID)" is useless.
> >
> > Best regards
> >
> >
>
>
> Hello
>
>
> After more testing this Patches allow several CAM models to work and
> don't seem to make any regression.
>
> Is there anything to be improved/tested for having it included upstream ?
>
> Thank you
>
> Regards
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libdvben50221] stack leaks resources on non-MMI session reconnect.
2010-11-02 10:38 ` Stephan Trebels
@ 2010-11-02 16:18 ` pierre.gronlier
0 siblings, 0 replies; 6+ messages in thread
From: pierre.gronlier @ 2010-11-02 16:18 UTC (permalink / raw)
To: linux-media
Stephan Trebels wrote, On 11/02/2010 11:38 AM:
> Hi Brice,
>
> I did not find more things to be changed, and it works fine for me now.
> Given, that the responsiveness on this list is a bit underwhelming, I
> wonder whether we can find someone with commit privileges, to push this
> change.
>
Hi,
I've tested this patch too and it solves problems with two different
cams. (powercam v4 and cryptoworks by philips)
Commiting it would be great.
--
Pierre
> Stephan
>
> On Tue, 2010-11-02 at 11:15 +0100, DUBOST Brice wrote:
>> On 08/08/2010 23:53, DUBOST Brice wrote:
>>> On 15/07/2010 15:20, Stephan Trebels wrote:
>>>>
>>>> The issue was, that LIBDVBEN50221 did not allow a CAM to re-establish
>>>> the session holding non-MMI resources if using the lowlevel interface.
>>>> The session_number was recorded on open, but not freed on close (which
>>>> IMO is an bug in the code, I attach the scaled down hg changeset). With
>>>> this change, the SMIT CAM with a showtime card works fine according to
>>>> tests so far.
>>>>
>>>> The effect was, that the CAM tried to constantly close and re-open the
>>>> session and the LIBDVBEN50221 kept telling it, that the resource is
>>>> already allocated to a different session. Additionally this caused the
>>>> library to use the _old_ session number in communications with the CAM,
>>>> which did not even exist anymore, so caused all writes of CA PMTs to
>>>> fail with EINTR.
>>>>
>>>> Stephan
>>>>
>>>
>>> Hello
>>>
>>> Just to inform that this patch solves problems with CAM PowerCAM v4.3,
>>> so I think it can interest more people.
>>>
>>> Before gnutv -cammenu (and other applications using libdvben50221) was
>>> returning ti;eout (-3) errors constantly after the display of the system
>>> IDs.
>>>
>>> Now, the menu is working flawlessly
>>>
>>> I cannot test the descrambling for the moment but it improved quite a
>>> lot the situation (communication with th CAM is now possible).
>>>
>>> One note concerning the patch itself, the last "else if (resource_id ==
>>> EN50221_APP_MMI_RESOURCEID)" is useless.
>>>
>>> Best regards
>>>
>>>
>>
>>
>> Hello
>>
>>
>> After more testing this Patches allow several CAM models to work and
>> don't seem to make any regression.
>>
>> Is there anything to be improved/tested for having it included upstream ?
>>
>> Thank you
>>
>> Regards
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libdvben50221] stack leaks resources on non-MMI session reconnect.
@ 2010-11-07 20:41 Ludovic BOUE
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic BOUE @ 2010-11-07 20:41 UTC (permalink / raw)
To: linux-media
Hi,
I'm using this patch and it solves problems with a Powercam HD v3.1
Thank you for the commit as soon as possible. I would be easier for
libdvben50221 users.
--
Ludovic
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-11-07 20:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-15 13:20 [libdvben50221] stack leaks resources on non-MMI session reconnect Stephan Trebels
2010-08-08 21:53 ` DUBOST Brice
2010-11-02 10:15 ` DUBOST Brice
2010-11-02 10:38 ` Stephan Trebels
2010-11-02 16:18 ` pierre.gronlier
-- strict thread matches above, loose matches on Subject: below --
2010-11-07 20:41 Ludovic BOUE
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).