aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink/af_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/netlink/af_netlink.c')
-rw-r--r--net/netlink/af_netlink.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 336d9c6dcad9..767c84e10e20 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2307,6 +2307,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
2307 size_t tlvlen = 0; 2307 size_t tlvlen = 0;
2308 struct netlink_sock *nlk = nlk_sk(NETLINK_CB(in_skb).sk); 2308 struct netlink_sock *nlk = nlk_sk(NETLINK_CB(in_skb).sk);
2309 unsigned int flags = 0; 2309 unsigned int flags = 0;
2310 bool nlk_has_extack = nlk->flags & NETLINK_F_EXT_ACK;
2310 2311
2311 /* Error messages get the original request appened, unless the user 2312 /* Error messages get the original request appened, unless the user
2312 * requests to cap the error message, and get extra error data if 2313 * requests to cap the error message, and get extra error data if
@@ -2317,7 +2318,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
2317 payload += nlmsg_len(nlh); 2318 payload += nlmsg_len(nlh);
2318 else 2319 else
2319 flags |= NLM_F_CAPPED; 2320 flags |= NLM_F_CAPPED;
2320 if (nlk->flags & NETLINK_F_EXT_ACK && extack) { 2321 if (nlk_has_extack && extack) {
2321 if (extack->_msg) 2322 if (extack->_msg)
2322 tlvlen += nla_total_size(strlen(extack->_msg) + 1); 2323 tlvlen += nla_total_size(strlen(extack->_msg) + 1);
2323 if (extack->bad_attr) 2324 if (extack->bad_attr)
@@ -2326,8 +2327,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
2326 } else { 2327 } else {
2327 flags |= NLM_F_CAPPED; 2328 flags |= NLM_F_CAPPED;
2328 2329
2329 if (nlk->flags & NETLINK_F_EXT_ACK && 2330 if (nlk_has_extack && extack && extack->cookie_len)
2330 extack && extack->cookie_len)
2331 tlvlen += nla_total_size(extack->cookie_len); 2331 tlvlen += nla_total_size(extack->cookie_len);
2332 } 2332 }
2333 2333
@@ -2347,7 +2347,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
2347 errmsg->error = err; 2347 errmsg->error = err;
2348 memcpy(&errmsg->msg, nlh, payload > sizeof(*errmsg) ? nlh->nlmsg_len : sizeof(*nlh)); 2348 memcpy(&errmsg->msg, nlh, payload > sizeof(*errmsg) ? nlh->nlmsg_len : sizeof(*nlh));
2349 2349
2350 if (nlk->flags & NETLINK_F_EXT_ACK && extack) { 2350 if (nlk_has_extack && extack) {
2351 if (err) { 2351 if (err) {
2352 if (extack->_msg) 2352 if (extack->_msg)
2353 WARN_ON(nla_put_string(skb, NLMSGERR_ATTR_MSG, 2353 WARN_ON(nla_put_string(skb, NLMSGERR_ATTR_MSG,