Commit 1baff47
ksmbd: fix use-after-free in smb2_open during durable reconnect
In smb2_open, the call to ksmbd_put_durable_fd(fp) drops the reference
to the durable file descriptor early during the durable reconnect
process. If an error occurs subsequently (eg, ksmbd_iov_pin_rsp fails)
or a scavenger accesses the file, it leads to a use-after-free when
accessing fp properties (eg fp->create_time).
Move the single put to the end of the function below err_out2 so fp
stays valid until smb2_open returns.
Fixes: c8efcc7 ("ksmbd: add support for durable handles v1/v2")
Signed-off-by: Akif <akif.sait111@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>1 parent 3e4e2ea commit 1baff47
1 file changed
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3014 | 3014 | | |
3015 | 3015 | | |
3016 | 3016 | | |
3017 | | - | |
3018 | | - | |
| 3017 | + | |
3019 | 3018 | | |
3020 | | - | |
3021 | 3019 | | |
3022 | 3020 | | |
3023 | | - | |
3024 | | - | |
| 3021 | + | |
3025 | 3022 | | |
3026 | | - | |
3027 | 3023 | | |
3028 | 3024 | | |
3029 | 3025 | | |
3030 | 3026 | | |
3031 | 3027 | | |
3032 | | - | |
3033 | 3028 | | |
3034 | 3029 | | |
3035 | 3030 | | |
3036 | 3031 | | |
3037 | 3032 | | |
3038 | 3033 | | |
3039 | | - | |
3040 | 3034 | | |
3041 | 3035 | | |
3042 | 3036 | | |
| |||
3806 | 3800 | | |
3807 | 3801 | | |
3808 | 3802 | | |
| 3803 | + | |
| 3804 | + | |
| 3805 | + | |
3809 | 3806 | | |
3810 | 3807 | | |
3811 | 3808 | | |
| |||
0 commit comments