diff options
| author | Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> | 2026-03-18 14:31:43 +0300 |
|---|---|---|
| committer | Jason Wang <jasowang@redhat.com> | 2026-05-26 14:09:31 +0800 |
| commit | eb3fb508385ce2fc15c738126a1ef5c8b0a19cf4 (patch) | |
| tree | 3b846b2f42f764db0e9fdeef29f7c46c9ace60ae /net | |
| parent | 8faa6cd071e2ad930308be10c5a11a178e6b42d9 (diff) | |
| download | qemu-eb3fb508385ce2fc15c738126a1ef5c8b0a19cf4.tar.gz qemu-eb3fb508385ce2fc15c738126a1ef5c8b0a19cf4.zip | |
net/tap: check that user tries to define zero queues
Add check for queues parameter to be non-zero, and for fd/fds
parameters to be non-empty.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net')
| -rw-r--r-- | net/tap.c | 4 | ||||
| -rw-r--r-- | net/util.c | 5 |
2 files changed, 9 insertions, 0 deletions
@@ -807,6 +807,10 @@ static int tap_parse_fds_and_queues(const NetdevTapOptions *tap, int **fds, error_setg(errp, "queues exceeds maximum %d", INT_MAX); return -1; } + if (tap->queues == 0) { + error_setg(errp, "queues must be greater than zero"); + return -1; + } queues = tap->queues; *fds = NULL; } else if (tap->fd || tap->fds) { diff --git a/net/util.c b/net/util.c index 1998a6554e..8265f15548 100644 --- a/net/util.c +++ b/net/util.c @@ -94,6 +94,11 @@ int net_parse_fds(const char *fds_param, int **fds, int expected_nfds, return -1; } + if (nfds == 0) { + error_setg(errp, "no fds passed"); + return -1; + } + *fds = g_new(int, nfds); for (i = 0; i < nfds; i++) { |
