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-5.16-2' of git://linux-nfs.org/~bfields/linux

Pull nfsd fixes from Bruce Fields:
"Fix a race on startup and another in the delegation code.

The latter has been around for years, but I suspect recent changes may
have widened the race window a little, so I'd like to go ahead and get
it in"

* tag 'nfsd-5.16-2' of git://linux-nfs.org/~bfields/linux:
nfsd: fix use-after-free due to delegation race
nfsd: Fix nsfd startup race (again)

+15 -9
+1
fs/nfsd/nfs4recover.c
··· 2156 2156 int 2157 2157 register_cld_notifier(void) 2158 2158 { 2159 + WARN_ON(!nfsd_net_id); 2159 2160 return rpc_pipefs_notifier_register(&nfsd4_cld_block); 2160 2161 } 2161 2162
+7 -2
fs/nfsd/nfs4state.c
··· 1207 1207 return 0; 1208 1208 } 1209 1209 1210 + static bool delegation_hashed(struct nfs4_delegation *dp) 1211 + { 1212 + return !(list_empty(&dp->dl_perfile)); 1213 + } 1214 + 1210 1215 static bool 1211 1216 unhash_delegation_locked(struct nfs4_delegation *dp) 1212 1217 { ··· 1219 1214 1220 1215 lockdep_assert_held(&state_lock); 1221 1216 1222 - if (list_empty(&dp->dl_perfile)) 1217 + if (!delegation_hashed(dp)) 1223 1218 return false; 1224 1219 1225 1220 dp->dl_stid.sc_type = NFS4_CLOSED_DELEG_STID; ··· 4603 4598 * queued for a lease break. Don't queue it again. 4604 4599 */ 4605 4600 spin_lock(&state_lock); 4606 - if (dp->dl_time == 0) { 4601 + if (delegation_hashed(dp) && dp->dl_time == 0) { 4607 4602 dp->dl_time = ktime_get_boottime_seconds(); 4608 4603 list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru); 4609 4604 }
+7 -7
fs/nfsd/nfsctl.c
··· 1521 1521 int retval; 1522 1522 printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); 1523 1523 1524 - retval = register_cld_notifier(); 1525 - if (retval) 1526 - return retval; 1527 1524 retval = nfsd4_init_slabs(); 1528 1525 if (retval) 1529 - goto out_unregister_notifier; 1526 + return retval; 1530 1527 retval = nfsd4_init_pnfs(); 1531 1528 if (retval) 1532 1529 goto out_free_slabs; ··· 1542 1545 goto out_free_exports; 1543 1546 retval = register_pernet_subsys(&nfsd_net_ops); 1544 1547 if (retval < 0) 1548 + goto out_free_filesystem; 1549 + retval = register_cld_notifier(); 1550 + if (retval) 1545 1551 goto out_free_all; 1546 1552 return 0; 1547 1553 out_free_all: 1554 + unregister_pernet_subsys(&nfsd_net_ops); 1555 + out_free_filesystem: 1548 1556 unregister_filesystem(&nfsd_fs_type); 1549 1557 out_free_exports: 1550 1558 remove_proc_entry("fs/nfs/exports", NULL); ··· 1563 1561 nfsd4_exit_pnfs(); 1564 1562 out_free_slabs: 1565 1563 nfsd4_free_slabs(); 1566 - out_unregister_notifier: 1567 - unregister_cld_notifier(); 1568 1564 return retval; 1569 1565 } 1570 1566 1571 1567 static void __exit exit_nfsd(void) 1572 1568 { 1569 + unregister_cld_notifier(); 1573 1570 unregister_pernet_subsys(&nfsd_net_ops); 1574 1571 nfsd_drc_slab_free(); 1575 1572 remove_proc_entry("fs/nfs/exports", NULL); ··· 1578 1577 nfsd4_free_slabs(); 1579 1578 nfsd4_exit_pnfs(); 1580 1579 unregister_filesystem(&nfsd_fs_type); 1581 - unregister_cld_notifier(); 1582 1580 } 1583 1581 1584 1582 MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");