Please backport commit 0dc54bd4d6e03be1f0b678c4297170b79f1a44ab ("fscache_cookie_enabled: check cookie is valid before accessing it") to the 5.13, 5.14, and 5.15 kernel series.
Commit 0dc54bd4d6e03be1f0b678c4297170b79f1a44ab fixes a bug introduced by 3003bbd0697b659944237f3459489cb596ba196c ("afs: Use the netfs_write_begin() helper") that results in a NULL pointer dereference observed in Fedora 35 when accessing afs volumes from Kubernetes.
[ 3627.403829] BUG: kernel NULL pointer dereference, address: 0000000000000068 [ 3627.411649] RIP: 0010:afs_is_cache_enabled+0xc/0x30 [kafs] [ 3627.419900] Call Trace: [ 3627.420432] <TASK> [ 3627.420957] netfs_write_begin+0x1ff/0x810 [netfs] [ 3627.421498] ? lock_timer_base+0x61/0x80 [ 3627.422124] afs_write_begin+0x58/0x240 [kafs] [ 3627.422738] generic_perform_write+0xae/0x1d0 [ 3627.423325] ? file_update_time+0xd2/0x120 [ 3627.423806] __generic_file_write_iter+0x101/0x1d0 [ 3627.424275] generic_file_write_iter+0x5d/0xb0 [ 3627.424741] afs_file_write+0x73/0xa0 [kafs] [ 3627.425270] new_sync_write+0x10b/0x180 [ 3627.425708] vfs_write+0x1ce/0x260 [ 3627.426160] ksys_write+0x4f/0xc0 [ 3627.426606] do_syscall_64+0x3b/0x90 [ 3627.427086] entry_SYSCALL_64_after_hwframe+0x44/0xae
The defect was introduced in v5.13-rc1 and fixed in v5.16-rc1.
Thank you and Happy New Year.
Jeffrey Altman