hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/net/scm.h
....@@ -105,16 +105,27 @@
105105 }
106106 }
107107 }
108
+
109
+static inline bool scm_has_secdata(struct socket *sock)
110
+{
111
+ return test_bit(SOCK_PASSSEC, &sock->flags);
112
+}
108113 #else
109114 static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
110115 { }
116
+
117
+static inline bool scm_has_secdata(struct socket *sock)
118
+{
119
+ return false;
120
+}
111121 #endif /* CONFIG_SECURITY_NETWORK */
112122
113123 static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
114124 struct scm_cookie *scm, int flags)
115125 {
116126 if (!msg->msg_control) {
117
- if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp)
127
+ if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp ||
128
+ scm_has_secdata(sock))
118129 msg->msg_flags |= MSG_CTRUNC;
119130 scm_destroy(scm);
120131 return;