Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'nfsd-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux

Pull nfsd fixes from Chuck Lever:

- Two minor bug fixes

* tag 'nfsd-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
nfsd: fix double fget() bug in __write_ports_addfd()
nfsd: make a copy of struct iattr before calling notify_change

+19 -29
+1 -6
fs/nfsd/nfsctl.c
··· 690 690 if (err != 0 || fd < 0) 691 691 return -EINVAL; 692 692 693 - if (svc_alien_sock(net, fd)) { 694 - printk(KERN_ERR "%s: socket net is different to NFSd's one\n", __func__); 695 - return -EINVAL; 696 - } 697 - 698 693 err = nfsd_create_serv(net); 699 694 if (err != 0) 700 695 return err; 701 696 702 - err = svc_addsock(nn->nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred); 697 + err = svc_addsock(nn->nfsd_serv, net, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred); 703 698 704 699 if (err >= 0 && 705 700 !nn->nfsd_serv->sv_nrthreads && !xchg(&nn->keep_active, 1))
+9 -1
fs/nfsd/vfs.c
··· 536 536 537 537 inode_lock(inode); 538 538 for (retries = 1;;) { 539 - host_err = __nfsd_setattr(dentry, iap); 539 + struct iattr attrs; 540 + 541 + /* 542 + * notify_change() can alter its iattr argument, making 543 + * @iap unsuitable for submission multiple times. Make a 544 + * copy for every loop iteration. 545 + */ 546 + attrs = *iap; 547 + host_err = __nfsd_setattr(dentry, &attrs); 540 548 if (host_err != -EAGAIN || !retries--) 541 549 break; 542 550 if (!nfsd_wait_for_delegreturn(rqstp, inode))
+3 -4
include/linux/sunrpc/svcsock.h
··· 61 61 void svc_send(struct svc_rqst *rqstp); 62 62 void svc_drop(struct svc_rqst *); 63 63 void svc_sock_update_bufs(struct svc_serv *serv); 64 - bool svc_alien_sock(struct net *net, int fd); 65 - int svc_addsock(struct svc_serv *serv, const int fd, 66 - char *name_return, const size_t len, 67 - const struct cred *cred); 64 + int svc_addsock(struct svc_serv *serv, struct net *net, 65 + const int fd, char *name_return, const size_t len, 66 + const struct cred *cred); 68 67 void svc_init_xprt_sock(void); 69 68 void svc_cleanup_xprt_sock(void); 70 69 struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot);
+6 -18
net/sunrpc/svcsock.c
··· 1480 1480 return svsk; 1481 1481 } 1482 1482 1483 - bool svc_alien_sock(struct net *net, int fd) 1484 - { 1485 - int err; 1486 - struct socket *sock = sockfd_lookup(fd, &err); 1487 - bool ret = false; 1488 - 1489 - if (!sock) 1490 - goto out; 1491 - if (sock_net(sock->sk) != net) 1492 - ret = true; 1493 - sockfd_put(sock); 1494 - out: 1495 - return ret; 1496 - } 1497 - EXPORT_SYMBOL_GPL(svc_alien_sock); 1498 - 1499 1483 /** 1500 1484 * svc_addsock - add a listener socket to an RPC service 1501 1485 * @serv: pointer to RPC service to which to add a new listener 1486 + * @net: caller's network namespace 1502 1487 * @fd: file descriptor of the new listener 1503 1488 * @name_return: pointer to buffer to fill in with name of listener 1504 1489 * @len: size of the buffer ··· 1493 1508 * Name is terminated with '\n'. On error, returns a negative errno 1494 1509 * value. 1495 1510 */ 1496 - int svc_addsock(struct svc_serv *serv, const int fd, char *name_return, 1497 - const size_t len, const struct cred *cred) 1511 + int svc_addsock(struct svc_serv *serv, struct net *net, const int fd, 1512 + char *name_return, const size_t len, const struct cred *cred) 1498 1513 { 1499 1514 int err = 0; 1500 1515 struct socket *so = sockfd_lookup(fd, &err); ··· 1505 1520 1506 1521 if (!so) 1507 1522 return err; 1523 + err = -EINVAL; 1524 + if (sock_net(so->sk) != net) 1525 + goto out; 1508 1526 err = -EAFNOSUPPORT; 1509 1527 if ((so->sk->sk_family != PF_INET) && (so->sk->sk_family != PF_INET6)) 1510 1528 goto out;