diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2019-06-04 12:00:11 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-04 13:34:37 -0700 |
commit | 27393f8c6efc03b8e0b64134721b0d337fca0a80 (patch) | |
tree | 7bf67aa55e7e022f587517963fe81ab00c97eb7c /net/tls | |
parent | f4cfcfbdf03cf7cf5f9097803415dfdcf965676c (diff) | |
download | linux-stable-27393f8c6efc03b8e0b64134721b0d337fca0a80.tar.gz linux-stable-27393f8c6efc03b8e0b64134721b0d337fca0a80.tar.bz2 linux-stable-27393f8c6efc03b8e0b64134721b0d337fca0a80.zip |
Revert "net/tls: avoid NULL-deref on resync during device removal"
This reverts commit 38030d7cb77963ba84cdbe034806e2b81245339f.
Unfortunately the RX resync may get called from soft IRQ,
so we can't take the rwsem to protect from the device
disappearing.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tls')
-rw-r--r-- | net/tls/tls_device.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index b95c408fd771..49b3a2ff8ef3 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -553,8 +553,8 @@ void tls_device_write_space(struct sock *sk, struct tls_context *ctx) void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn) { struct tls_context *tls_ctx = tls_get_ctx(sk); + struct net_device *netdev = tls_ctx->netdev; struct tls_offload_context_rx *rx_ctx; - struct net_device *netdev; u32 is_req_pending; s64 resync_req; u32 req_seq; @@ -568,15 +568,10 @@ void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn) is_req_pending = resync_req; if (unlikely(is_req_pending) && req_seq == seq && - atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0)) { - seq += TLS_HEADER_SIZE - 1; - down_read(&device_offload_lock); - netdev = tls_ctx->netdev; - if (netdev) - netdev->tlsdev_ops->tls_dev_resync_rx(netdev, sk, seq, - rcd_sn); - up_read(&device_offload_lock); - } + atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0)) + netdev->tlsdev_ops->tls_dev_resync_rx(netdev, sk, + seq + TLS_HEADER_SIZE - 1, + rcd_sn); } static int tls_device_reencrypt(struct sock *sk, struct sk_buff *skb) |