diff mbox series

[ovs-dev] dpif-netlink: Fix potential leak of a malformed meters netlink reply.

Message ID 20251030105119.1603148-1-i.maximets@ovn.org
State Accepted
Commit b4c158d9766a5002e18c44f6e59c21b463346c03
Delegated to: aaron conole
Headers show
Series [ovs-dev] dpif-netlink: Fix potential leak of a malformed meters netlink reply. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/cirrus-robot success cirrus build: passed
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Ilya Maximets Oct. 30, 2025, 10:51 a.m. UTC
If netlink transaction returns malformed or otherwise not parsable
reply, it should be freed, as callers will not do that on failure.

Found while reading the code.

Fixes: 80738e5f93a7 ("dpif-netlink: Add meter support.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 lib/dpif-netlink.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Aaron Conole Nov. 6, 2025, 4:44 p.m. UTC | #1
Ilya Maximets <i.maximets@ovn.org> writes:

> If netlink transaction returns malformed or otherwise not parsable
> reply, it should be freed, as callers will not do that on failure.
>
> Found while reading the code.
>
> Fixes: 80738e5f93a7 ("dpif-netlink: Add meter support.")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---

Good catch!

Acked-by: Aaron Conole <aconole@redhat.com>
Ilya Maximets Nov. 6, 2025, 10 p.m. UTC | #2
On 11/6/25 5:44 PM, Aaron Conole wrote:
> Ilya Maximets <i.maximets@ovn.org> writes:
> 
>> If netlink transaction returns malformed or otherwise not parsable
>> reply, it should be freed, as callers will not do that on failure.
>>
>> Found while reading the code.
>>
>> Fixes: 80738e5f93a7 ("dpif-netlink: Add meter support.")
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
>> ---
> 
> Good catch!
> 
> Acked-by: Aaron Conole <aconole@redhat.com>
> 

Thanks!  Applied and backported down to 3.3.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 2b33d0fa6..c327296ea 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -4083,6 +4083,7 @@  dpif_netlink_meter_transact(struct ofpbuf *request, struct ofpbuf **replyp,
         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
         VLOG_DBG_RL(&rl,
                     "Kernel module response to meter tranaction is invalid");
+        ofpbuf_delete(*replyp);
         return EINVAL;
     }
     return 0;