[libdvben50221] stack leaks resources on non-MMI session reconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
# HG changeset patch
# User Stephan Trebels <stephan@xxxxxxxxxxx>
# 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: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux