コード例 #1
0
ファイル: sock.c プロジェクト: chinnyannieb/empeg-hijack
static int ncp_do_request(struct ncp_server *server, int size,
		void* reply, int max_reply_size)
{
	int result;

	if (server->lock == 0) {
		printk(KERN_ERR "ncpfs: Server not locked!\n");
		return -EIO;
	}
	if (!ncp_conn_valid(server)) {
		return -EIO;
	}
#ifdef CONFIG_NCPFS_PACKET_SIGNING
	if (server->sign_active)
	{
		sign_packet(server, &size);
	}
#endif /* CONFIG_NCPFS_PACKET_SIGNING */
	result = do_ncp_rpc_call(server, size, reply, max_reply_size);

	DDPRINTK(KERN_DEBUG "do_ncp_rpc_call returned %d\n", result);

	if (result < 0) {
		/* There was a problem with I/O, so the connections is
		 * no longer usable. */
		ncp_invalidate_conn(server);
	}
	return result;
}
コード例 #2
0
ファイル: sock.c プロジェクト: 274914765/C
static int ncp_do_request(struct ncp_server *server, int size,
        void* reply, int max_reply_size)
{
    int result;

    if (server->lock == 0) {
        printk(KERN_ERR "ncpfs: Server not locked!\n");
        return -EIO;
    }
    if (!ncp_conn_valid(server)) {
        printk(KERN_ERR "ncpfs: Connection invalid!\n");
        return -EIO;
    }
    {
        sigset_t old_set;
        unsigned long mask, flags;

        spin_lock_irqsave(&current->sighand->siglock, flags);
        old_set = current->blocked;
        if (current->flags & PF_EXITING)
            mask = 0;
        else
            mask = sigmask(SIGKILL);
        if (server->m.flags & NCP_MOUNT_INTR) {
            /* FIXME: This doesn't seem right at all.  So, like,
               we can't handle SIGINT and get whatever to stop?
               What if we've blocked it ourselves?  What about
               alarms?  Why, in fact, are we mucking with the
               sigmask at all? -- r~ */
            if (current->sighand->action[SIGINT - 1].sa.sa_handler == SIG_DFL)
                mask |= sigmask(SIGINT);
            if (current->sighand->action[SIGQUIT - 1].sa.sa_handler == SIG_DFL)
                mask |= sigmask(SIGQUIT);
        }
        siginitsetinv(&current->blocked, mask);
        recalc_sigpending();
        spin_unlock_irqrestore(&current->sighand->siglock, flags);
        
        result = do_ncp_rpc_call(server, size, reply, max_reply_size);

        spin_lock_irqsave(&current->sighand->siglock, flags);
        current->blocked = old_set;
        recalc_sigpending();
        spin_unlock_irqrestore(&current->sighand->siglock, flags);
    }

    DDPRINTK("do_ncp_rpc_call returned %d\n", result);

    return result;
}
コード例 #3
0
ファイル: sock.c プロジェクト: 3sOx/asuswrt-merlin
static int ncp_do_request(struct ncp_server *server, int size,
		void* reply, int max_reply_size)
{
	int result;

	if (server->lock == 0) {
		printk(KERN_ERR "ncpfs: Server not locked!\n");
		return -EIO;
	}
	if (!ncp_conn_valid(server)) {
		printk(KERN_ERR "ncpfs: Connection invalid!\n");
		return -EIO;
	}
	{
		sigset_t old_set;
		unsigned long mask, flags;

		spin_lock_irqsave(&current->sighand->siglock, flags);
		old_set = current->blocked;
		if (current->flags & PF_EXITING)
			mask = 0;
		else
			mask = sigmask(SIGKILL);
		if (server->m.flags & NCP_MOUNT_INTR) {
			if (current->sighand->action[SIGINT - 1].sa.sa_handler == SIG_DFL)
				mask |= sigmask(SIGINT);
			if (current->sighand->action[SIGQUIT - 1].sa.sa_handler == SIG_DFL)
				mask |= sigmask(SIGQUIT);
		}
		siginitsetinv(&current->blocked, mask);
		recalc_sigpending();
		spin_unlock_irqrestore(&current->sighand->siglock, flags);
		
		result = do_ncp_rpc_call(server, size, reply, max_reply_size);

		spin_lock_irqsave(&current->sighand->siglock, flags);
		current->blocked = old_set;
		recalc_sigpending();
		spin_unlock_irqrestore(&current->sighand->siglock, flags);
	}

	DDPRINTK("do_ncp_rpc_call returned %d\n", result);

	return result;
}
コード例 #4
0
ファイル: sock.c プロジェクト: JBTech/ralink_rt5350
static int ncp_do_request(struct ncp_server *server, int size,
		void* reply, int max_reply_size)
{
	struct file *file;
	struct socket *sock;
	int result;

	if (server->lock == 0) {
		printk(KERN_ERR "ncpfs: Server not locked!\n");
		return -EIO;
	}
	if (!ncp_conn_valid(server)) {
		return -EIO;
	}
#ifdef CONFIG_NCPFS_PACKET_SIGNING
	if (server->sign_active)
	{
		sign_packet(server, &size);
	}
#endif /* CONFIG_NCPFS_PACKET_SIGNING */
	file = server->ncp_filp;
	sock = &file->f_dentry->d_inode->u.socket_i;
	/* N.B. this isn't needed ... check socket type? */
	if (!sock) {
		printk(KERN_ERR "ncp_rpc_call: socki_lookup failed\n");
		result = -EBADF;
	} else {
		mm_segment_t fs;
		sigset_t old_set;
		unsigned long mask, flags;

		spin_lock_irqsave(&current->sigmask_lock, flags);
		old_set = current->blocked;
		if (current->flags & PF_EXITING)
			mask = 0;
		else
			mask = sigmask(SIGKILL);
		if (server->m.flags & NCP_MOUNT_INTR) {
			/* FIXME: This doesn't seem right at all.  So, like,
			   we can't handle SIGINT and get whatever to stop?
			   What if we've blocked it ourselves?  What about
			   alarms?  Why, in fact, are we mucking with the
			   sigmask at all? -- r~ */
			if (current->sig->action[SIGINT - 1].sa.sa_handler == SIG_DFL)
				mask |= sigmask(SIGINT);
			if (current->sig->action[SIGQUIT - 1].sa.sa_handler == SIG_DFL)
				mask |= sigmask(SIGQUIT);
		}
		siginitsetinv(&current->blocked, mask);
		recalc_sigpending(current);
		spin_unlock_irqrestore(&current->sigmask_lock, flags);
		
		fs = get_fs();
		set_fs(get_ds());

		if (sock->type == SOCK_STREAM)
			result = do_ncp_tcp_rpc_call(server, size, reply, max_reply_size);
		else
			result = do_ncp_rpc_call(server, size, reply, max_reply_size);

		set_fs(fs);

		spin_lock_irqsave(&current->sigmask_lock, flags);
		current->blocked = old_set;
		recalc_sigpending(current);
		spin_unlock_irqrestore(&current->sigmask_lock, flags);
	}

	DDPRINTK("do_ncp_rpc_call returned %d\n", result);

	if (result < 0) {
		/* There was a problem with I/O, so the connections is
		 * no longer usable. */
		ncp_invalidate_conn(server);
	}
	return result;
}