1 #if !defined(_RDMA_IB_H)
4 #include <linux/sched.h>
7 * The IB interfaces that use write() as bi-directional ioctl() are
8 * fundamentally unsafe, since there are lots of ways to trigger "write()"
9 * calls from various contexts with elevated privileges. That includes the
10 * traditional suid executable error message writes, but also various kernel
11 * interfaces that can write to file descriptors.
13 * This function provides protection for the legacy API by restricting the
16 static inline bool ib_safe_file_access(struct file *filp)
18 return filp->f_cred == current_cred() && segment_eq(get_fs(), USER_DS);
21 #endif /* _RDMA_IB_H */