]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: target: tcmu: Fix possible page UAF
authorXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Fri, 11 Mar 2022 13:22:05 +0000 (21:22 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 30 Mar 2022 03:07:56 +0000 (23:07 -0400)
commitdff79ad5a12ee95415a1122a65028488827c6d6a
tree2afc4fb879689dc8aca4a9a74908a1d661c553f6
parent48e93f9c6e7eac53746d074b583492025bed6793
scsi: target: tcmu: Fix possible page UAF

tcmu_try_get_data_page() looks up pages under cmdr_lock, but it does not
take refcount properly and just returns page pointer. When
tcmu_try_get_data_page() returns, the returned page may have been freed by
tcmu_blocks_release().

We need to get_page() under cmdr_lock to avoid concurrent
tcmu_blocks_release().

Link: https://lore.kernel.org/r/20220311132206.24515-1-xiaoguang.wang@linux.alibaba.com
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_user.c