Re: [PATCH 03/36] target: Don't drain empty list

Dmitry Bogdanov
2022-07-07T12:42:35Z

On Wed, Jul 06, 2022 at 04:34:42PM -0700, Thinh Nguyen wrote:
> If the preempt_and_abort_list is NULL, don't attempt to drain it.
> Otherwise, it may lead to invalid access.
>
> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
> drivers/target/target_core_tmr.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
> index bac111456fa1..7a7e24069ba7 100644
> --- a/drivers/target/target_core_tmr.c
> +++ b/drivers/target/target_core_tmr.c
> @@ -383,9 +383,11 @@ int core_tmr_lun_reset(
> (preempt_and_abort_list) ? "Preempt" : "TMR",
> dev->transport->name, tas);
>
> - core_tmr_drain_tmr_list(dev, tmr, preempt_and_abort_list);
> - core_tmr_drain_state_list(dev, prout_cmd, tmr_sess, tas,
> - preempt_and_abort_list);
> + if (preempt_and_abort_list) {
> + core_tmr_drain_tmr_list(dev, tmr, preempt_and_abort_list);
> + core_tmr_drain_state_list(dev, prout_cmd, tmr_sess, tas,
> + preempt_and_abort_list);
> + }
Those functions are not about to drain preempt_and_abort_list. And there
are no invalid access inside.
This patch breaks the tmf_abort functionality.
NACK
>
> /*
> * Clear any legacy SPC-2 reservation when called during