msgrcv bug?

From: Andrey Ilinykh (ailinykh@usa.net)
Date: Thu Sep 06 2001 - 12:18:46 EST


Hi!
sys_msgrcv contains such code as (ipc/msg.c):

771 list_del(&msg->m_list);
772 msq->q_qnum--;
773 msq->q_rtime = CURRENT_TIME;
774 msq->q_lrpid = current->pid;
775 msq->q_cbytes -= msg->m_ts;
776 atomic_sub(msg->m_ts,&msg_bytes);
777 atomic_dec(&msg_hdrs);
778 ss_wakeup(&msq->q_senders,0);
779 msg_unlock(msqid);
780 out_success:
781 msgsz = (msgsz > msg->m_ts) ? msg->m_ts : msgsz;
782 if (put_user (msg->m_type, &msgp->mtype) ||
783 store_msg(msgp->mtext, msg, msgsz)) {
784 msgsz = -EFAULT;
785 }
786 free_msg(msg);
787 return msgsz;

if put_user fails (user process passed wrond address) message will not be
delivered, but it is already removed from list. So nobody will receive this
message. Is this behavior correct?
Thank you,
  Andrey
Please cc to my e-mail also.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 07 2001 - 21:00:36 EST