[cpia] client probs

sbertin@mindspring.com sbertin@mindspring.com
Thu, 2 Mar 2000 17:53:36 -0500 (EST)


--1037094400-1804289383-952037626=:860
Content-Type: TEXT/plain; charset=us-ascii

On  2 Mar, Bastian wrote:
> At 18:06 1.3.2000 -0500, sbertin@mindspring.com wrote:
>>On  1 Mar, Bastian wrote:
>> > but when i try to start a client (xawtv, gqcam) i always get a 
>> segmentation
>> > fault.
>> > dmesg says :
>> >
>> > -------------
>> > Unable to handle kernel NULL pointer dereference at virtual address 
>> 0000000c
>>
>>What do you see just before this?
> 
> THIS is the first line in dmesg (after the lines telling that loading 
> modules is ok)

Sorry, I was expecting more.  I did find a case where a NULL pointer
dereference would occur if the driver was unable to create the
/proc entry for the camera.  The attached patch will fix that.

Scott J. Bertin
sbertin@mindspring.com


--1037094400-1804289383-952037626=:860
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Disposition: attachment; filename="fix_proc.patch"

diff -u -r cpia-0.7.2/module/cpia.c cpia/module/cpia.c
--- cpia-0.7.2/module/cpia.c	Sun Feb 27 14:19:32 2000
+++ cpia/module/cpia.c	Thu Mar  2 17:49:33 2000
@@ -1332,11 +1332,12 @@
 {
 	char name[7];
 	
-	if (!cam->proc_entry)
+	if (!cam || !cam->proc_entry)
 		return;
 	
 	sprintf(name, "video%d", cam->vdev.minor);
 	remove_proc_entry(name, cpia_proc_root);
+	cam->proc_entry = NULL;
 }
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
@@ -2525,7 +2526,8 @@
 	}
 	
 	/* Set ownership of /proc/cpia/videoX to current user */
-	cam->proc_entry->uid = current->uid;
+	if(cam->proc_entry)
+		cam->proc_entry->uid = current->uid;
 
 	/* set mark for loading first frame uncompressed */
 	cam->first_frame = 1;
@@ -2548,7 +2550,8 @@
 
 	if (cam->ops) {
 	        /* Return ownership of /proc/cpia/videoX to root */
-		cam->proc_entry->uid = 0;
+		if(cam->proc_entry)
+			cam->proc_entry->uid = 0;
 	
 		/* save camera state for later open (developers guide ch 3.5.3) */
 		save_camera_state(cam);

--1037094400-1804289383-952037626=:860--