diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2024-01-17 21:58:28 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-01-17 21:58:28 +0100 |
commit | fe33c0fbed75dd464747c0faaedf94c7d8eb4101 (patch) | |
tree | 057a9d98ca492c55708baedcc59bf2ea3e2511c7 /tools/net/ynl/lib/ynl.c | |
parent | userfaultfd: avoid huge_zero_page in UFFDIO_MOVE (diff) | |
parent | Merge tag 'exfat-for-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff) | |
download | linux-fe33c0fbed75dd464747c0faaedf94c7d8eb4101.tar.xz linux-fe33c0fbed75dd464747c0faaedf94c7d8eb4101.zip |
Merge branch 'master' into mm-hotfixes-stable
Diffstat (limited to 'tools/net/ynl/lib/ynl.c')
-rw-r--r-- | tools/net/ynl/lib/ynl.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/net/ynl/lib/ynl.c b/tools/net/ynl/lib/ynl.c index 830d25097009..c82a7f41b31c 100644 --- a/tools/net/ynl/lib/ynl.c +++ b/tools/net/ynl/lib/ynl.c @@ -145,8 +145,10 @@ ynl_ext_ack_check(struct ynl_sock *ys, const struct nlmsghdr *nlh, const struct nlattr *attr; const char *str = NULL; - if (!(nlh->nlmsg_flags & NLM_F_ACK_TLVS)) + if (!(nlh->nlmsg_flags & NLM_F_ACK_TLVS)) { + yerr_msg(ys, "%s", strerror(ys->err.code)); return MNL_CB_OK; + } mnl_attr_for_each(attr, nlh, hlen) { unsigned int len, type; @@ -189,12 +191,12 @@ ynl_ext_ack_check(struct ynl_sock *ys, const struct nlmsghdr *nlh, str ? " (" : ""); start = mnl_nlmsg_get_payload_offset(ys->nlh, - sizeof(struct genlmsghdr)); + ys->family->hdr_len); end = mnl_nlmsg_get_payload_tail(ys->nlh); off = ys->err.attr_offs; off -= sizeof(struct nlmsghdr); - off -= sizeof(struct genlmsghdr); + off -= ys->family->hdr_len; n += ynl_err_walk(ys, start, end, off, ys->req_policy, &bad_attr[n], sizeof(bad_attr) - n, NULL); @@ -215,14 +217,14 @@ ynl_ext_ack_check(struct ynl_sock *ys, const struct nlmsghdr *nlh, bad_attr[0] ? ", " : (str ? " (" : "")); start = mnl_nlmsg_get_payload_offset(ys->nlh, - sizeof(struct genlmsghdr)); + ys->family->hdr_len); end = mnl_nlmsg_get_payload_tail(ys->nlh); nest_pol = ys->req_policy; if (tb[NLMSGERR_ATTR_MISS_NEST]) { off = mnl_attr_get_u32(tb[NLMSGERR_ATTR_MISS_NEST]); off -= sizeof(struct nlmsghdr); - off -= sizeof(struct genlmsghdr); + off -= ys->family->hdr_len; n += ynl_err_walk(ys, start, end, off, ys->req_policy, &miss_attr[n], sizeof(miss_attr) - n, @@ -249,6 +251,8 @@ ynl_ext_ack_check(struct ynl_sock *ys, const struct nlmsghdr *nlh, yerr_msg(ys, "Kernel %s: %s%s", ys->err.code ? "error" : "warning", bad_attr, miss_attr); + else + yerr_msg(ys, "%s", strerror(ys->err.code)); return MNL_CB_OK; } |