net/mlx4_en: Fix mixed PFC and Global pause user control requests
[pandora-kernel.git] / include / rdma / ib.h
1 #if !defined(_RDMA_IB_H)
2 #define _RDMA_IB_H
3
4 #include <linux/sched.h>
5
6 /*
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.
12  *
13  * This function provides protection for the legacy API by restricting the
14  * calling context.
15  */
16 static inline bool ib_safe_file_access(struct file *filp)
17 {
18         return filp->f_cred == current_cred() && segment_eq(get_fs(), USER_DS);
19 }
20
21 #endif /* _RDMA_IB_H */