CodeConstruct / mctp

MCTP userspace tools
GNU General Public License v2.0
32 stars 19 forks source link

mctpd: fix return value check in control socket reads #41

Closed jk-ozlabs closed 4 months ago

jk-ozlabs commented 4 months ago

Currently, we're checking the return value of read_message against 0 to detect EOF, but this isn't a length value. This means that any successful read will hit the errx.

Instead, check the actual length, and improve the read_message case where we see an EOF from the recvmsg().

Fixes: ea5c9a3 ("mctpd: Exit on control socket EOF")

jk-ozlabs commented 4 months ago

Now with a testcase.

jk-ozlabs commented 4 months ago

(merged at https://github.com/CodeConstruct/mctp/commit/36da928bdc3fd3f4af382e079b4997e6d11a363c)