bypass: af-packet: fix memory leak - reassign of EBPFBypassData

AF-Packet bypass function in some situations allocates EBPF bypass data
for an already bypassed flow and assigns it to the flow without any checks

Issue: #5368
pull/7511/head
Lukas Sismis 4 years ago committed by Victor Julien
parent 05797c45bb
commit 8845c07a90

@ -2133,6 +2133,12 @@ static int AFPSetFlowStorage(Packet *p, int map_fd, void *key0, void* key1,
{
FlowBypassInfo *fc = FlowGetStorageById(p->flow, GetFlowBypassInfoID());
if (fc) {
if (fc->bypass_data != NULL) {
// bypass already activated
SCFree(key0);
SCFree(key1);
return 1;
}
EBPFBypassData *eb = SCCalloc(1, sizeof(EBPFBypassData));
if (eb == NULL) {
EBPFDeleteKey(map_fd, key0);

Loading…
Cancel
Save