Re: [PATCH V2] target: fix a race condition between login_work and the login thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



út 15. 11. 2022 v 9:33 odesílatel Maurizio Lombardi
<mlombard@xxxxxxxxxx> napsal:
>
> pá 11. 11. 2022 v 16:47 odesílatel Maurizio Lombardi
> <mlombard@xxxxxxxxxx> napsal:
> >
> >
> > Fix this bug by forcing login_work to stop after the login has been
> > completed and the socket callbacks have been restored.
> > Also fix other potential race conditions in the error paths.
>
> Self-NACK
>
> I can't call cancel_delayed_work_sync() in iscsi_target_do_login()
> because the latter could be called from the login_work context
> and this will cause a deadlock.
>
> Will submit a V3 when ready

The correct place where to call cancel_delayed_work_sync() is in
iscsi_target_start_negotiation(), because the latter is only called
in the login_thread context.

I'm going to test the following:

diff --git a/drivers/target/iscsi/iscsi_target_nego.c
b/drivers/target/iscsi/iscsi_target_nego.c
index f2919319ad38..b9bd77f41c8d 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -1363,12 +1363,14 @@ int iscsi_target_start_negotiation(
                ret = -1;

        if (ret < 0) {
-               cancel_delayed_work_sync(&conn->login_work);
                iscsi_target_restore_sock_callbacks(conn);
+               cancel_delayed_work_sync(&conn->login_work);
                iscsi_remove_failed_auth_entry(conn);
        }
-       if (ret != 0)
+       if (ret != 0) {
+               cancel_delayed_work_sync(&conn->login_work);
                iscsi_target_nego_release(conn);
+       }

        return ret;
 }



Maurizio





[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux