@@ -1970,7 +1970,8 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
19701970#define UNIX_SKB_FRAGS_SZ (PAGE_SIZE << get_order(32768))
19711971
19721972#if IS_ENABLED (CONFIG_AF_UNIX_OOB )
1973- static int queue_oob (struct socket * sock , struct msghdr * msg , struct sock * other )
1973+ static int queue_oob (struct socket * sock , struct msghdr * msg , struct sock * other ,
1974+ struct scm_cookie * scm , bool fds_sent )
19741975{
19751976 struct unix_sock * ousk = unix_sk (other );
19761977 struct sk_buff * skb ;
@@ -1981,6 +1982,11 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other
19811982 if (!skb )
19821983 return err ;
19831984
1985+ err = unix_scm_to_skb (scm , skb , !fds_sent );
1986+ if (err < 0 ) {
1987+ kfree_skb (skb );
1988+ return err ;
1989+ }
19841990 skb_put (skb , 1 );
19851991 err = skb_copy_datagram_from_iter (skb , 0 , & msg -> msg_iter , 1 );
19861992
@@ -2108,7 +2114,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
21082114
21092115#if IS_ENABLED (CONFIG_AF_UNIX_OOB )
21102116 if (msg -> msg_flags & MSG_OOB ) {
2111- err = queue_oob (sock , msg , other );
2117+ err = queue_oob (sock , msg , other , & scm , fds_sent );
21122118 if (err )
21132119 goto out_err ;
21142120 sent ++ ;
0 commit comments