/* Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.  */
int gnet_stats_finish_copy(struct gnet_dump *d)
/* Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.  */
int gnet_stats_finish_copy(struct gnet_dump *d)
{
	if (d->tail)
		d->tail->nla_len = skb_tail_pointer(d->skb) - (u8 *)d->tail;
	if (d->compat_tc_stats)
		if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats,
			sizeof(d->tc_stats)) < 0)
			return -1;
	if (d->compat_xstats && d->xstats) {
		if (gnet_stats_copy(d, d->compat_xstats, d->xstats,
			d->xstats_len) < 0)
			return -1;
	}
	spin_unlock_bh(d->lock);
	return 0;
}