mq_receive1: Handle the possible dereference, when cv_timedwait_sig() awakes

normally (without the error) and MQ_UNLINK is set.
From CID: 4565.
This commit is contained in:
rmind 2007-10-09 18:27:00 +00:00
parent 25e540085b
commit f07012313b
1 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_mqueue.c,v 1.2 2007/09/21 01:40:10 ad Exp $ */
/* $NetBSD: sys_mqueue.c,v 1.3 2007/10/09 18:27:00 rmind Exp $ */
/*
* Copyright (c) 2007, Mindaugas Rasiukevicius <rmind at NetBSD org>
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.2 2007/09/21 01:40:10 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.3 2007/10/09 18:27:00 rmind Exp $");
#include <sys/param.h>
#include <sys/types.h>
@ -473,8 +473,7 @@ mq_receive1(struct lwp *l, mqd_t mqdes, void *msg_ptr, size_t msg_len,
error = cv_timedwait_sig(&mq->mq_send_cv, &mq->mq_mtx, t);
mq->mq_attrib.mq_flags &= ~MQ_RECEIVE;
if (error || (mq->mq_attrib.mq_flags & MQ_UNLINK)) {
if (error == EWOULDBLOCK)
error = ETIMEDOUT;
error = (error == EWOULDBLOCK) ? ETIMEDOUT : EINTR;
goto error;
}
}