Christian Schoenebeck
3f61ac7c65
fs/9p: fix NULL pointer dereference on mkdir
When a 9p tree was mounted with option 'posixacl', parent directory had a
default ACL set for its subdirectories, e.g.:
setfacl -m default:group:simpsons:rwx parentdir
then creating a subdirectory crashed 9p client, as v9fs_fid_add() call in
function v9fs_vfs_mkdir_dotl() sets the passed 'fid' pointer to NULL
(since dafbe68973) even though the subsequent v9fs_set_create_acl() call
expects a valid non-NULL 'fid' pointer:
[ 37.273191] BUG: kernel NULL pointer dereference, address: 0000000000000000
...
[ 37.322338] Call Trace:
[ 37.323043] <TASK>
[ 37.323621] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434)
[ 37.324448] ? page_fault_oops (arch/x86/mm/fault.c:714)
[ 37.325532] ? search_module_extables (kernel/module/main.c:3733)
[ 37.326742] ? p9_client_walk (net/9p/client.c:1165) 9pnet
[ 37.328006] ? search_bpf_extables (kernel/bpf/core.c:804)
[ 37.329142] ? exc_page_fault (./arch/x86/include/asm/paravirt.h:686 arch/x86/mm/fault.c:1488 arch/x86/mm/fault.c:1538)
[ 37.330196] ? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:574)
[ 37.331330] ? p9_client_walk (net/9p/client.c:1165) 9pnet
[ 37.332562] ? v9fs_fid_xattr_get (fs/9p/xattr.c:30) 9p
[ 37.333824] v9fs_fid_xattr_set (fs/9p/fid.h:23 fs/9p/xattr.c:121) 9p
[ 37.335077] v9fs_set_acl (fs/9p/acl.c:276) 9p
[ 37.336112] v9fs_set_create_acl (fs/9p/acl.c:307) 9p
[ 37.337326] v9fs_vfs_mkdir_dotl (fs/9p/vfs_inode_dotl.c:411) 9p
[ 37.338590] vfs_mkdir (fs/namei.c:4313)
[ 37.339535] do_mkdirat (fs/namei.c:4336)
[ 37.340465] __x64_sys_mkdir (fs/namei.c:4354)
[ 37.341455] do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83)
[ 37.342447] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
Fix this by simply swapping the sequence of these two calls in
v9fs_vfs_mkdir_dotl(), i.e. calling v9fs_set_create_acl() before
v9fs_fid_add().
Fixes: dafbe68973 ("9p fid refcount: cleanup p9_fid_put calls")
Reported-by: syzbot+5b667f9a1fee4ba3775a@syzkaller.appspotmail.com
Signed-off-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Message-ID: <E1tsiI6-002iMG-Kh@kylie.crudebyte.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
2025-03-17 07:03:11 +09:00
..
2025-03-17 07:03:11 +09:00
2024-10-08 14:41:53 +02:00
2024-10-08 14:41:53 +02:00
2025-01-09 17:21:41 +01:00
2024-10-28 13:16:56 +01:00
2024-11-25 16:09:48 -08:00
2024-09-18 11:44:43 +02:00
2024-08-07 11:33:21 +02:00
2025-01-16 08:54:33 -08:00
2024-12-20 22:07:56 +01:00
2024-12-16 23:25:44 +01:00
2024-08-19 13:45:03 +02:00
2024-11-14 07:45:20 +01:00
2024-07-15 11:14:59 -07:00
2024-11-19 10:43:44 -08:00
2025-01-10 09:41:53 +01:00
2024-11-18 10:05:57 -06:00
2024-11-26 13:39:02 -08:00
2024-12-15 15:33:41 -08:00
2024-10-15 15:58:36 +02:00
2024-12-16 21:02:07 +08:00
2024-12-31 17:51:21 +09:00
2024-11-15 11:34:57 +01:00
2024-09-16 09:14:02 +02:00
2024-11-18 16:32:58 -08:00
2024-11-26 12:50:58 -08:00
2024-10-17 00:28:06 -07:00
2024-11-06 10:42:06 +01:00
2025-01-07 15:43:07 +01:00
2024-11-26 12:34:50 -08:00
2024-12-02 15:32:19 +01:00
2024-11-18 09:35:30 -08:00
2024-11-15 20:55:32 +01:00
2024-10-08 14:41:53 +02:00
2024-12-18 19:04:42 -08:00
2025-01-09 16:09:20 +01:00
2024-11-06 20:24:41 +01:00
2024-12-04 12:00:05 +01:00
2024-12-05 12:31:40 +01:00
2024-11-21 09:59:59 -08:00
2024-11-26 12:59:30 -08:00
2024-08-07 11:33:36 +02:00
2025-01-09 17:20:04 +01:00
2025-01-06 10:26:39 -08:00
2024-11-18 20:23:12 -05:00
2024-12-23 12:16:15 -08:00
2024-12-18 19:04:45 -08:00
2024-10-02 17:23:23 -04:00
2024-12-19 15:18:27 +01:00
2024-11-01 11:19:53 +03:00
2025-01-15 21:15:44 -08:00
2024-08-07 11:33:21 +02:00
2024-06-20 09:46:01 +02:00
2024-10-02 17:23:23 -04:00
2025-01-06 15:43:55 +01:00
2025-01-12 19:03:38 -08:00
2024-12-01 15:12:43 -08:00
2024-12-03 10:40:36 +01:00
2024-11-26 22:54:00 +01:00
2024-08-21 22:32:58 +02:00
2025-01-15 16:56:06 -06:00
2024-10-30 20:14:12 -07:00
2024-11-05 14:00:28 +01:00
2024-08-07 11:33:36 +02:00
2024-07-22 18:25:47 -07:00
2024-11-01 08:38:14 -04:00
2024-11-30 10:32:47 -08:00
2024-11-26 22:54:24 +01:00
2024-11-12 19:02:12 -05:00
2024-12-11 14:11:23 -08:00
2024-08-07 11:32:02 +02:00
2024-08-20 14:03:18 -04:00
2025-01-10 10:12:48 +01:00
2024-10-02 12:02:15 -07:00
2024-11-19 16:35:06 -08:00
2024-10-10 10:20:51 +02:00
2024-11-26 18:13:29 +01:00
2024-11-27 12:51:30 +01:00
2024-11-27 12:51:30 +01:00
2024-10-02 17:23:23 -04:00
2024-11-27 12:51:30 +01:00
2024-08-07 11:26:54 -07:00
2024-11-23 09:58:07 -08:00
2024-10-22 11:16:57 +02:00
2024-10-17 18:38:49 +01:00
2024-10-22 11:16:58 +02:00
2024-10-07 13:51:47 +02:00
2024-11-23 09:58:07 -08:00
2024-08-19 13:45:02 +02:00
2024-07-24 20:59:29 +02:00
2024-11-03 01:28:06 -05:00
2024-11-21 08:28:08 -08:00
2024-11-27 12:51:30 +01:00
2024-11-25 15:16:49 +01:00
2024-11-26 13:26:15 -08:00
2024-10-30 09:58:02 +01:00
2024-12-17 13:38:46 +01:00
2024-11-18 10:45:06 -08:00
2024-11-13 14:08:34 +01:00
2024-11-03 01:28:06 -05:00
2024-11-23 09:58:07 -08:00
2024-11-18 14:54:10 -08:00
2024-11-03 01:28:06 -05:00
2024-10-21 16:29:38 +02:00
2024-06-19 13:13:55 -07:00
2024-11-03 01:28:06 -05:00
2024-11-18 14:54:10 -08:00
2024-11-03 01:28:06 -05:00
2024-10-21 16:29:38 +02:00
2024-09-24 15:29:42 -07:00
2025-01-09 16:58:50 +01:00
2024-10-28 13:26:54 +01:00
2024-11-18 12:44:25 -08:00
2025-01-09 17:03:21 +01:00
2024-09-27 08:18:43 -07:00
2024-11-21 09:55:45 -08:00
2024-10-24 13:54:51 +02:00
2024-09-27 08:18:43 -07:00
2024-10-22 11:16:59 +02:00
2024-06-28 14:36:43 +02:00
2024-11-18 12:24:06 -08:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:07 -05:00
2024-11-03 01:28:07 -05:00
2024-10-22 11:16:57 +02:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00
2024-11-18 14:54:10 -08:00
2024-11-03 01:28:06 -05:00
2024-10-21 14:30:26 +02:00
2024-11-03 01:28:06 -05:00
2024-11-19 16:35:06 -08:00
2024-10-28 21:40:38 -07:00
2024-11-03 01:28:06 -05:00
2024-11-06 13:00:01 -05:00