1377 if (skb==NULL)
1378 goto out;
1379
1380 memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
1381 if (siocb->scm->fp) {
1382 err = unix_attach_fds(siocb->scm, skb);
1383 if (err)
1384 goto out_free;
1385 }
1386 unix_get_secdata(siocb->scm, skb);
1387
1388 skb_reset_transport_header(skb);
1389 err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
1390 if (err)
1391 goto out_free;
1392
1393 timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
1394
1395restart:
1396 if (!other) {
1397 err = -ECONNRESET;
1398 if (sunaddr == NULL)
1399 goto out_free;
1400
1401 other = unix_find_other(net, sunaddr, namelen, sk->sk_type,
1402 hash, &err);
1403 if (other==NULL)
1404 goto out_free;
1405 }
1406
1407 unix_state_lock(other);
1408 err = -EPERM;
1409 if (!unix_may_send(sk, other))
1410 goto out_unlock;
1411
1412 if (sock_flag(other, SOCK_DEAD)) {
1413
1414
1415
1416
1417 unix_state_unlock(other);