aboutsummaryrefslogtreecommitdiff
path: root/net/core/gen_stats.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-07-25 17:34:18 +0100
committerMark Brown <broonie@kernel.org>2018-07-25 17:34:18 +0100
commit8c9257333713c1f185693fe0df2df79dfc1fa1c8 (patch)
tree60d7fb9170d3cf462685be490b59bf1c012389d3 /net/core/gen_stats.c
parent953cb6f07855d41f79b6faa2f334d11116d54afb (diff)
parentdbcdf42bab53d219caa51bcfe54c8b9066010290 (diff)
Merge tag 'v4.9.115' into linux-linaro-lsk-v4.9lsk-v4.9-18.07
This is the 4.9.115 stable release
Diffstat (limited to 'net/core/gen_stats.c')
-rw-r--r--net/core/gen_stats.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 508e051304fb..18f17e1e5762 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -77,8 +77,20 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
d->lock = lock;
spin_lock_bh(lock);
}
- if (d->tail)
- return gnet_stats_copy(d, type, NULL, 0, padattr);
+ if (d->tail) {
+ int ret = gnet_stats_copy(d, type, NULL, 0, padattr);
+
+ /* The initial attribute added in gnet_stats_copy() may be
+ * preceded by a padding attribute, in which case d->tail will
+ * end up pointing at the padding instead of the real attribute.
+ * Fix this so gnet_stats_finish_copy() adjusts the length of
+ * the right attribute.
+ */
+ if (ret == 0 && d->tail->nla_type == padattr)
+ d->tail = (struct nlattr *)((char *)d->tail +
+ NLA_ALIGN(d->tail->nla_len));
+ return ret;
+ }
return 0;
}