netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, secdev@chelsio.com
Subject: Re: [PATCH net-next] net/tls: fix race condition causing kernel panic
Date: Thu, 21 May 2020 11:56:23 -0700	[thread overview]
Message-ID: <20200521115623.134eeb83@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <0a5d0864-2830-6bc8-05e8-232d10c0f333@chelsio.com>

On Thu, 21 May 2020 14:28:27 +0530 Vinay Kumar Yadav wrote:
> Considering the lock in fix ("pending" is local variable), when writer reads
> pending == 0 [pending = atomic_read(&ctx->encrypt_pending); --> from tls_sw_sendmsg()],
> that means encrypt complete() [from tls_encrypt_done()] is already called.

Please indulge me with full sentences. I can't parse this.

> and if pending == 1 [pending = atomic_read(&ctx->encrypt_pending); --> from tls_sw_sendmsg()],
> that means writer is going to wait for atomic_dec_return(&ctx->decrypt_pending) and
> complete() [from tls_encrypt_done()]  to be called atomically.
> 
> This way, writer is not going to proceed to encrypt next record on CPU0 without complete().


  reply	other threads:[~2020-05-21 18:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  7:43 [PATCH net-next] net/tls: fix race condition causing kernel panic Vinay Kumar Yadav
2020-05-19 19:16 ` David Miller
2020-05-20 17:09   ` Vinay Kumar Yadav
2020-05-20 19:58     ` Jakub Kicinski
2020-05-21  8:58       ` Vinay Kumar Yadav
2020-05-21 18:56         ` Jakub Kicinski [this message]
2020-05-21 20:32           ` Vinay Kumar Yadav
2020-05-21 21:40             ` Jakub Kicinski
     [not found]           ` <bbcfb6c7-8e98-63a1-4ff6-d185bdcf4708@chelsio.com>
2020-05-21 21:38             ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200521115623.134eeb83@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=secdev@chelsio.com \
    --cc=vinay.yadav@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).