current->state = TASK_INTERRUPTIBLE; schedule_timeout(HZ/8);  /* Propagate thread->control  */ 
schedule_timeout_interruptible(msecs_to_jiffies(125));  /* Propagate thread->control  */ 
static int proc_thread_write(struct file *file, const char __user *user_buffer,                                unsigned long count, void *data){	int i = 0, max, len, ret;	char name[40];        struct pktgen_thread *t;        char *pg_result;        unsigned long value = 0;        	if (count < 1) {		//	sprintf(pg_result, "Wrong command format");		return -EINVAL;	}  	max = count - i;        len = count_trail_chars(&user_buffer[i], max);        if (len < 0) 		return len;      	i += len;  	/* Read variable name */	len = strn_len(&user_buffer[i], sizeof(name) - 1);        if (len < 0)  		return len; 		memset(name, 0, sizeof(name));	if (copy_from_user(name, &user_buffer[i], len))		return -EFAULT;	i += len;  	max = count -i;	len = count_trail_chars(&user_buffer[i], max);        if (len < 0)  		return len; 		i += len;	if (debug) 		printk("pktgen: t=%s, count=%lu\n", name, count);                t = (struct pktgen_thread*)(data);	if(!t) {		printk("pktgen: ERROR: No thread\n");		ret = -EINVAL;		goto out;	}	pg_result = &(t->result[0]);        if (!strcmp(name, "add_device")) {                char f[32];                memset(f, 0, 32);		len = strn_len(&user_buffer[i], sizeof(f) - 1);                if (len < 0) { 			ret = len; 			goto out;		}		if( copy_from_user(f, &user_buffer[i], len) )			return -EFAULT;		i += len;		thread_lock();                pktgen_add_device(t, f);		thread_unlock();                ret = count;                sprintf(pg_result, "OK: add_device=%s", f);		goto out;	}        if (!strcmp(name, "rem_device_all")) {		thread_lock();		t->control |= T_REMDEV;		thread_unlock();		current->state = TASK_INTERRUPTIBLE;		schedule_timeout(HZ/8);  /* Propagate thread->control  */		ret = count;                sprintf(pg_result, "OK: rem_device_all");		goto out;	}        if (!strcmp(name, "max_before_softirq")) {                len = num_arg(&user_buffer[i], 10, &value);		thread_lock();                t->max_before_softirq = value;		thread_unlock();                ret = count;                sprintf(pg_result, "OK: max_before_softirq=%lu", value);		goto out;	}	ret = -EINVAL; out:	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/121caf577dc61588c1128821873a08cec48baf58/pktgen.c/buggy/net/core/pktgen.c