File tree 1 file changed +9
-5
lines changed 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 9
9
#include <linux/pid.h>
10
10
#include <linux/nsproxy.h>
11
11
#include <linux/sched/signal.h>
12
+ #include <net/compat.h>
12
13
13
14
/* Well, we should have at least one descriptor open
14
15
* to accept passed FDs 8)
@@ -123,14 +124,17 @@ static inline bool scm_has_secdata(struct socket *sock)
123
124
static __inline__ void scm_pidfd_recv (struct msghdr * msg , struct scm_cookie * scm )
124
125
{
125
126
struct file * pidfd_file = NULL ;
126
- int pidfd ;
127
+ int len , pidfd ;
127
128
128
- /*
129
- * put_cmsg() doesn't return an error if CMSG is truncated,
129
+ /* put_cmsg() doesn't return an error if CMSG is truncated,
130
130
* that's why we need to opencode these checks here.
131
131
*/
132
- if ((msg -> msg_controllen <= sizeof (struct cmsghdr )) ||
133
- (msg -> msg_controllen - sizeof (struct cmsghdr )) < sizeof (int )) {
132
+ if (msg -> msg_flags & MSG_CMSG_COMPAT )
133
+ len = sizeof (struct compat_cmsghdr ) + sizeof (int );
134
+ else
135
+ len = sizeof (struct cmsghdr ) + sizeof (int );
136
+
137
+ if (msg -> msg_controllen < len ) {
134
138
msg -> msg_flags |= MSG_CTRUNC ;
135
139
return ;
136
140
}
You can’t perform that action at this time.
0 commit comments