laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34256 )
Change subject: osmo_io: Change parent of msghdr to iofd (instead of msg) ......................................................................
osmo_io: Change parent of msghdr to iofd (instead of msg)
msg was made a parent of msghdr after discussion in change I3a279b55a3adff96948120683c844e1508d0ba94
It turns out this violates some assumptions made in osmo_io, specifically that the user read callback shall free msg, but we expect msghdr to remain valid until after that callback returns.
In general I think it is cleaner to make iofd a parent of msghdr.
Change-Id: I41277190e3020cd8fa625bd57a743973e2a65c4b --- M src/core/osmo_io.c 1 file changed, 19 insertions(+), 1 deletion(-)
Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index e176099..c67787b 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -120,7 +120,7 @@ talloc_steal(iofd, msg); }
- hdr = talloc_zero(msg, struct iofd_msghdr); + hdr = talloc_zero(iofd, struct iofd_msghdr); if (!hdr) { if (free_msg) talloc_free(msg);