diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-11-06 17:54:19 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-11-07 12:47:22 +0100 |
commit | 6f913b3af062a889f70758f8d3a458dcf0ac0cdd (patch) | |
tree | ae0b3882cf4081824fe27d5276b2bf8bbe152039 | |
parent | d8e05a3fe0f2db444c51342888b37ed351b66f63 (diff) | |
download | passt-6f913b3af062a889f70758f8d3a458dcf0ac0cdd.tar passt-6f913b3af062a889f70758f8d3a458dcf0ac0cdd.tar.gz passt-6f913b3af062a889f70758f8d3a458dcf0ac0cdd.tar.bz2 passt-6f913b3af062a889f70758f8d3a458dcf0ac0cdd.tar.lz passt-6f913b3af062a889f70758f8d3a458dcf0ac0cdd.tar.xz passt-6f913b3af062a889f70758f8d3a458dcf0ac0cdd.tar.zst passt-6f913b3af062a889f70758f8d3a458dcf0ac0cdd.zip |
udp: Don't dereference uflow before NULL check in udp_reply_sock_handler()
We have an ASSERT() verifying that we're able to look up the flow in
udp_reply_sock_handler(). However, we dereference uflow before that in
an initializer, rather defeating the point. Rearrange to avoid that.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | udp.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -644,12 +644,13 @@ void udp_reply_sock_handler(const struct ctx *c, union epoll_ref ref, flow_sidx_t tosidx = flow_sidx_opposite(ref.flowside); const struct flowside *toside = flowside_at_sidx(tosidx); struct udp_flow *uflow = udp_at_sidx(ref.flowside); - int from_s = uflow->s[ref.flowside.sidei]; uint8_t topif = pif_at_sidx(tosidx); - int n, i; + int n, i, from_s; ASSERT(!c->no_udp && uflow); + from_s = uflow->s[ref.flowside.sidei]; + if (udp_sock_errs(c, from_s, events) < 0) { flow_err(uflow, "Unrecoverable error on reply socket"); flow_err_details(uflow); |