[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <060332f0a4e1df27fc0ceadab2f9f430e61298ab.1444302968.git.sergei@s15v.net>
Date: Thu, 8 Oct 2015 14:32:11 +0300
From: Sergei Zviagintsev <sergei@...v.net>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Daniel Mack <daniel@...que.org>,
David Herrmann <dh.herrmann@...glemail.com>,
Djalal Harouni <tixxdz@...ndz.org>
Cc: linux-kernel@...r.kernel.org, Sergei Zviagintsev <sergei@...v.net>
Subject: [PATCH 42/44] kdbus: Check if fd is allocated before trying to free it
Elements of `fds' array were set to -1 in case if we couldn't allocate
a fd. Verify that element contains a valid fd number before submitting
it to put_unused_fd().
Signed-off-by: Sergei Zviagintsev <sergei@...v.net>
---
ipc/kdbus/message.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ipc/kdbus/message.c b/ipc/kdbus/message.c
index 0653a085c104..da685049d66c 100644
--- a/ipc/kdbus/message.c
+++ b/ipc/kdbus/message.c
@@ -221,7 +221,8 @@ int kdbus_gaps_install(struct kdbus_gaps *gaps, struct kdbus_pool_slice *slice,
exit:
if (ret < 0)
for (i = 0; i < n_fds; ++i)
- put_unused_fd(fds[i]);
+ if (fds[i] >= 0)
+ put_unused_fd(fds[i]);
kfree(fds);
*out_incomplete = incomplete_fds;
return ret;
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists