Commit 90962b48 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

net/tls: don't jump to return

Reusing parts of error path for normal exit will make
next commit harder to read, untangle the two.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarJohn Hurley <john.hurley@netronome.com>
Reviewed-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent be7bbea1
...@@ -838,22 +838,18 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx) ...@@ -838,22 +838,18 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
struct net_device *netdev; struct net_device *netdev;
char *iv, *rec_seq; char *iv, *rec_seq;
struct sk_buff *skb; struct sk_buff *skb;
int rc = -EINVAL;
__be64 rcd_sn; __be64 rcd_sn;
int rc;
if (!ctx) if (!ctx)
goto out; return -EINVAL;
if (ctx->priv_ctx_tx) { if (ctx->priv_ctx_tx)
rc = -EEXIST; return -EEXIST;
goto out;
}
start_marker_record = kmalloc(sizeof(*start_marker_record), GFP_KERNEL); start_marker_record = kmalloc(sizeof(*start_marker_record), GFP_KERNEL);
if (!start_marker_record) { if (!start_marker_record)
rc = -ENOMEM; return -ENOMEM;
goto out;
}
offload_ctx = kzalloc(TLS_OFFLOAD_CONTEXT_SIZE_TX, GFP_KERNEL); offload_ctx = kzalloc(TLS_OFFLOAD_CONTEXT_SIZE_TX, GFP_KERNEL);
if (!offload_ctx) { if (!offload_ctx) {
...@@ -982,7 +978,8 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx) ...@@ -982,7 +978,8 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
smp_store_release(&sk->sk_validate_xmit_skb, tls_validate_xmit_skb); smp_store_release(&sk->sk_validate_xmit_skb, tls_validate_xmit_skb);
dev_put(netdev); dev_put(netdev);
up_read(&device_offload_lock); up_read(&device_offload_lock);
goto out;
return 0;
release_netdev: release_netdev:
dev_put(netdev); dev_put(netdev);
...@@ -999,7 +996,6 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx) ...@@ -999,7 +996,6 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
ctx->priv_ctx_tx = NULL; ctx->priv_ctx_tx = NULL;
free_marker_record: free_marker_record:
kfree(start_marker_record); kfree(start_marker_record);
out:
return rc; return rc;
} }
...@@ -1058,7 +1054,11 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx) ...@@ -1058,7 +1054,11 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx)
goto free_sw_resources; goto free_sw_resources;
tls_device_attach(ctx, sk, netdev); tls_device_attach(ctx, sk, netdev);
goto release_netdev; up_read(&device_offload_lock);
dev_put(netdev);
return 0;
free_sw_resources: free_sw_resources:
up_read(&device_offload_lock); up_read(&device_offload_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment