[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200519.121641.1552016505379076766.davem@davemloft.net>
Date: Tue, 19 May 2020 12:16:41 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: vinay.yadav@...lsio.com
Cc: netdev@...r.kernel.org, kuba@...nel.org, secdev@...lsio.com
Subject: Re: [PATCH net-next] net/tls: fix race condition causing kernel
panic
From: Vinay Kumar Yadav <vinay.yadav@...lsio.com>
Date: Tue, 19 May 2020 13:13:27 +0530
> + spin_lock_bh(&ctx->encrypt_compl_lock);
> + pending = atomic_read(&ctx->encrypt_pending);
> + spin_unlock_bh(&ctx->encrypt_compl_lock);
The sequence:
lock();
x = p->y;
unlock();
Does not fix anything, and is superfluous locking.
The value of p->y can change right after the unlock() call, so you
aren't protecting the atomic'ness of the read and test sequence
because the test is outside of the lock.
Powered by blists - more mailing lists