if (recv_msg) { recv_msg->recv_type = IPMI_RESPONSE_RESPONSE_TYPE; recv_msg->msg.data = recv_msg->msg_data; recv_msg->msg.data_len = 1; recv_msg->msg_data[0] = msg->rsp[2]; deliver_response(recv_msg); } 
if (!recv_msg) goto out;  /* Make sure the user still exists. */ if (!recv_msg->user || !recv_msg->user->valid) goto out;  recv_msg->recv_type = IPMI_RESPONSE_RESPONSE_TYPE; recv_msg->msg.data = recv_msg->msg_data; recv_msg->msg.data_len = 1; recv_msg->msg_data[0] = msg->rsp[2]; deliver_response(recv_msg); 
static int handle_new_recv_msg(ipmi_smi_t          intf,			       struct ipmi_smi_msg *msg){	int requeue;	int chan;#ifdef DEBUG_MSGING	int m;	printk("Recv:");	for (m = 0; m < msg->rsp_size; m++)		printk(" %2.2x", msg->rsp[m]);	printk("\n");#endif	if (msg->rsp_size < 2) {		/* Message is too small to be correct. */		printk(KERN_WARNING PFX "BMC returned to small a message"		       " for netfn %x cmd %x, got %d bytes\n",		       (msg->data[0] >> 2) | 1, msg->data[1], msg->rsp_size);		/* Generate an error response for the message. */		msg->rsp[0] = msg->data[0] | (1 << 2);		msg->rsp[1] = msg->data[1];		msg->rsp[2] = IPMI_ERR_UNSPECIFIED;		msg->rsp_size = 3;	} else if (((msg->rsp[0] >> 2) != ((msg->data[0] >> 2) | 1))/* Netfn */		   || (msg->rsp[1] != msg->data[1]))		  /* Command */	{		/* The response is not even marginally correct. */		printk(KERN_WARNING PFX "BMC returned incorrect response,"		       " expected netfn %x cmd %x, got netfn %x cmd %x\n",		       (msg->data[0] >> 2) | 1, msg->data[1],		       msg->rsp[0] >> 2, msg->rsp[1]);		/* Generate an error response for the message. */		msg->rsp[0] = msg->data[0] | (1 << 2);		msg->rsp[1] = msg->data[1];		msg->rsp[2] = IPMI_ERR_UNSPECIFIED;		msg->rsp_size = 3;	}	if ((msg->rsp[0] == ((IPMI_NETFN_APP_REQUEST|1) << 2))	    && (msg->rsp[1] == IPMI_SEND_MSG_CMD)	    && (msg->user_data != NULL))	{		/* It's a response to a response we sent.  For this we		   deliver a send message response to the user. */		struct ipmi_recv_msg *recv_msg = msg->user_data;		requeue = 0;		if (msg->rsp_size < 2)			/* Message is too small to be correct. */			goto out;		chan = msg->data[2] & 0x0f;		if (chan >= IPMI_MAX_CHANNELS)			/* Invalid channel number */			goto out;		if (recv_msg) {			recv_msg->recv_type = IPMI_RESPONSE_RESPONSE_TYPE;			recv_msg->msg.data = recv_msg->msg_data;			recv_msg->msg.data_len = 1;			recv_msg->msg_data[0] = msg->rsp[2];			deliver_response(recv_msg);		}	} else if ((msg->rsp[0] == ((IPMI_NETFN_APP_REQUEST|1) << 2))		   && (msg->rsp[1] == IPMI_GET_MSG_CMD))	{		/* It's from the receive queue. */		chan = msg->rsp[3] & 0xf;		if (chan >= IPMI_MAX_CHANNELS) {			/* Invalid channel number */			requeue = 0;			goto out;		}		switch (intf->channels[chan].medium) {		case IPMI_CHANNEL_MEDIUM_IPMB:			if (msg->rsp[4] & 0x04) {				/* It's a response, so find the				   requesting message and send it up. */				requeue = handle_ipmb_get_msg_rsp(intf, msg);			} else {				/* It's a command to the SMS from some other				   entity.  Handle that. */				requeue = handle_ipmb_get_msg_cmd(intf, msg);			}			break;		case IPMI_CHANNEL_MEDIUM_8023LAN:		case IPMI_CHANNEL_MEDIUM_ASYNC:			if (msg->rsp[6] & 0x04) {				/* It's a response, so find the				   requesting message and send it up. */				requeue = handle_lan_get_msg_rsp(intf, msg);			} else {				/* It's a command to the SMS from some other				   entity.  Handle that. */				requeue = handle_lan_get_msg_cmd(intf, msg);			}			break;		default:			/* We don't handle the channel type, so just			 * free the message. */			requeue = 0;		}	} else if ((msg->rsp[0] == ((IPMI_NETFN_APP_REQUEST|1) << 2))		   && (msg->rsp[1] == IPMI_READ_EVENT_MSG_BUFFER_CMD))	{		/* It's an asyncronous event. */		requeue = handle_read_event_rsp(intf, msg);	} else {		/* It's a response from the local BMC. */		requeue = handle_bmc_rsp(intf, msg);	} out:	return requeue;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/393d2cc354d150b8b4bb888a9da7db4c935e12bd/ipmi_msghandler.c/buggy/drivers/char/ipmi/ipmi_msghandler.c