]> git.ipfire.org Git - thirdparty/iw.git/commit
iw: handle positive error codes gracefully
authorBrian Norris <briannorris@chromium.org>
Tue, 3 Nov 2020 23:56:31 +0000 (15:56 -0800)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 6 Nov 2020 08:53:32 +0000 (09:53 +0100)
commitfa72728c052a5f97ed432f66007654926cef4cb1
tree0e99b0fa730effb6ca8cfd29827d3e1d4e5607ec
parent7ba90935edd4f5b3690de55910aebeadc4898856
iw: handle positive error codes gracefully

netlink(7) requires error codes to be negative, but since when does a
man page stop anyone? At a minimum, we shouldn't allow a non-conforming
vendor command to put us into an infinite loop in the below snippets
from __handle_cmd():

err = 1;

nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err);
...
while (err > 0)
nl_recvmsgs(state->nl_sock, cb);

Signed-off-by: Brian Norris <briannorris@chromium.org>
Link: https://lore.kernel.org/r/20201103235631.2936594-1-briannorris@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
iw.c