[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/14] net: filter: correctly remove filter from the
From: |
Jason Wang |
Subject: |
[Qemu-devel] [PULL 02/14] net: filter: correctly remove filter from the list during finalization |
Date: |
Mon, 7 Mar 2016 11:12:48 +0800 |
Qemu may crash when we want to add two filters on the same netdev but
the initialization of second fails (e.g missing parameters):
./qemu-system-x86_64 -netdev user,id=un0 \
-object filter-buffer,id=f0,netdev=un0,interval=10 \
-object filter-buffer,id=f1,netdev=un0
Segmentation fault (core dumped)
This is because we don't check whether or not the filter was in the
list of netdev. This patch fixes this.
Cc: Yang Hongyang <address@hidden>
Reviewed-by: Yang Hongyang <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
net/filter.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/filter.c b/net/filter.c
index d2a514e..7cdbc6c 100644
--- a/net/filter.c
+++ b/net/filter.c
@@ -196,7 +196,8 @@ static void netfilter_finalize(Object *obj)
nfc->cleanup(nf);
}
- if (nf->netdev && !QTAILQ_EMPTY(&nf->netdev->filters)) {
+ if (nf->netdev && !QTAILQ_EMPTY(&nf->netdev->filters) &&
+ nf->next.tqe_prev) {
QTAILQ_REMOVE(&nf->netdev->filters, nf, next);
}
g_free(nf->netdev_id);
--
2.5.0
- [Qemu-devel] [PULL 00/14] Net patches, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 01/14] net: ne2000: check ring buffer control registers, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 02/14] net: filter: correctly remove filter from the list during finalization,
Jason Wang <=
- [Qemu-devel] [PULL 03/14] MAINTAINERS: Add entries for include/net/ files, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 04/14] net: simplify net_init_tap_one logic, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 05/14] net/filter-mirror:Add filter-mirror, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 06/14] tests/test-filter-mirror:add filter-mirror unit test, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 07/14] net: netmap: probe netmap interface for virtio-net header, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 08/14] rocker: forbid to change world type, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 09/14] rocker: return -ENOMEM in case of some world alloc fails, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 10/14] rocker: add name field into WorldOps ale let world specify its name, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 11/14] rocker: allow user to specify rocker world by property, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 12/14] filter: Add 'status' property for filter object, Jason Wang, 2016/03/06