2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-linux: Fix leak of a tc police get/del reply.

Direct leak of 64 byte(s) in 1 object(s) allocated from:
   0 0x51b1d8 in malloc (vswitchd/ovs-vswitchd+0x51b1d8)
   1 0xc81ded in xmalloc__ lib/util.c:137:15
   2 0xc81ded in xmalloc lib/util.c:172:12
   3 0xb32153 in ofpbuf_new lib/ofpbuf.c:168:24
   4 0xd563e4 in nl_sock_transact lib/netlink-socket.c:1113:34
   5 0xd56261 in nl_transact lib/netlink-socket.c:1812:13
   6 0xd5e096 in tc_transact lib/tc.c:238:17
   7 0xd01622 in tc_del_policer_action lib/netdev-linux.c:5807:13
   8 0xd2e681 in meter_tc_del_policer lib/netdev-offload-tc.c:2827:15
   9 0x94ec21 in meter_offload_del lib/netdev-offload.c:245:23
  10 0xcc86c4 in dpif_netlink_meter_del lib/dpif-netlink.c:4288:9
  11 0x86c595 in dpif_meter_del lib/dpif.c:2014:13
  12 0x663439 in free_meter_id ofproto/ofproto-dpif.c:6789:5
  13 0xb47518 in ovsrcu_call_postponed lib/ovs-rcu.c:346:13
  14 0xb48031 in ovsrcu_postpone_thread lib/ovs-rcu.c:362:14
  15 0xb5015a in ovsthread_wrapper lib/ovs-thread.c:422:12
  16 0x7f86af4081ce in start_thread (/lib64/libpthread.so.0+0x81ce)

Fixes: 5c039ddc64 ("netdev-linux: Add functions to manipulate tc police action")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
This commit is contained in:
Ilya Maximets
2022-07-13 16:30:41 +02:00
committed by Simon Horman
parent 4dd68ff85b
commit 0d153bffbf

View File

@@ -5711,22 +5711,24 @@ tc_update_policer_action_stats(struct ofpbuf *msg,
const struct nlattr *act;
struct nlattr *prio;
struct tcamsg *tca;
int error;
int error = 0;
if (!stats) {
return 0;
goto exit;
}
if (NLMSG_HDRLEN + sizeof *tca > msg->size) {
VLOG_ERR_RL(&rl, "Failed to get action stats, size error");
return EPROTO;
error = EPROTO;
goto exit;
}
tca = ofpbuf_at_assert(msg, NLMSG_HDRLEN, sizeof *tca);
act = nl_attr_find(msg, NLMSG_HDRLEN + sizeof *tca, TCA_ACT_TAB);
if (!act) {
VLOG_ERR_RL(&rl, "Failed to get action stats, can't find attribute");
return EPROTO;
error = EPROTO;
goto exit;
}
prio = (struct nlattr *) act + 1;
@@ -5747,6 +5749,8 @@ tc_update_policer_action_stats(struct ofpbuf *msg,
}
}
exit:
ofpbuf_delete(msg);
return error;
}