osmo_io: Assert that iofd mode is correct when calling *_write_msgb

Change-Id: Ief82ba7f9b280f85d66d68c358c36ba9866fe47a
Fixes: OS#6264
This commit is contained in:
Daniel Willmann 2023-11-21 10:10:37 +01:00 committed by laforge
parent 459cb06912
commit afdfc6a034
1 changed files with 1 additions and 0 deletions

View File

@ -356,6 +356,7 @@ int osmo_iofd_write_msgb(struct osmo_io_fd *iofd, struct msgb *msg)
{
int rc;
OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE);
if (OSMO_UNLIKELY(!iofd->io_ops.write_cb)) {
LOGPIO(iofd, LOGL_ERROR, "write_cb not set, Rejecting msgb\n");
return -EINVAL;