Commit 697679b7 authored by Jan Kiszka's avatar Jan Kiszka

cobalt/posix/mqueue: Fix crash after failing registration

If xnregistry_enter in mq_open fails, the new entry will not be added to
cobalt_mqq. But the cleanup path taken afterwards will nevertheless try
to remove it from there. That will cause a crash because the mq->link is
uninitialized. Fix that by initializing it as list head so that list
removal becomes harmless, even when the entry is not on any list..
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 3069a7bb
......@@ -151,6 +151,7 @@ static inline int mq_init(struct cobalt_mq *mq, const struct mq_attr *attr)
xnselect_init(&mq->write_select);
mq->magic = COBALT_MQ_MAGIC;
mq->refs = 2;
INIT_LIST_HEAD(&mq->link);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment