diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-03 13:53:20 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-03 13:53:20 +0200 |
| commit | 888dc273ea4e7ca332a6f73d10dfc8f2b212c803 (patch) | |
| tree | 0c2154dfa92ca6ee761c358e58a3e35831558bb5 /tools/io_uring/setup.c | |
| parent | 324e8f5f5d9d4d0b9a608b2fdb88cd93b0fbb12a (diff) | |
| parent | f2c7c76c5d0a443053e94adb9f0918fa2fb85c3a (diff) | |
Merge 5.2-rc3 into tty-next
We want the tty/serial fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/io_uring/setup.c')
| -rw-r--r-- | tools/io_uring/setup.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/io_uring/setup.c b/tools/io_uring/setup.c index 4da19a77132c..0b50fcd78520 100644 --- a/tools/io_uring/setup.c +++ b/tools/io_uring/setup.c @@ -27,7 +27,7 @@ static int io_uring_mmap(int fd, struct io_uring_params *p, sq->kdropped = ptr + p->sq_off.dropped; sq->array = ptr + p->sq_off.array; - size = p->sq_entries * sizeof(struct io_uring_sqe), + size = p->sq_entries * sizeof(struct io_uring_sqe); sq->sqes = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd, IORING_OFF_SQES); @@ -79,7 +79,7 @@ int io_uring_queue_mmap(int fd, struct io_uring_params *p, struct io_uring *ring int io_uring_queue_init(unsigned entries, struct io_uring *ring, unsigned flags) { struct io_uring_params p; - int fd; + int fd, ret; memset(&p, 0, sizeof(p)); p.flags = flags; @@ -88,7 +88,11 @@ int io_uring_queue_init(unsigned entries, struct io_uring *ring, unsigned flags) if (fd < 0) return fd; - return io_uring_queue_mmap(fd, &p, ring); + ret = io_uring_queue_mmap(fd, &p, ring); + if (ret) + close(fd); + + return ret; } void io_uring_queue_exit(struct io_uring *ring) |
