We explicitly verify the fd and then just increment the usage counter.
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
* @kmsg: Message
*
* Return: 0 on success, negative errno on failure.
+ *
+ * On errors, the caller should drop any taken reference with
+ * kdbus_kmsg_free()
*/
static int kdbus_msg_scan_items(struct kdbus_conn *conn,
struct kdbus_kmsg *kmsg)
int seals, mask;
int fd = item->memfd.fd;
+ /*
+ * Verify the fd and increment the usage
+ * count
+ */
if (fd < 0 || !(f = fget(fd)))
return -EBADF;
int ret;
int fd = item->fds[i];
+ /*
+ * Verify the fd and increment the
+ * usage count
+ */
if (fd < 0 || !(f = fget(fd)))
return -EBADF;