Skip to content

Commit

Permalink
chtls: Fix chtls resources release sequence
Browse files Browse the repository at this point in the history
CPL_ABORT_RPL is sent after releasing the resources by calling
chtls_release_resources(sk); and chtls_conn_done(sk);
eventually causing kernel panic. Fixing it by calling release
in appropriate order.

Fixes: cc35c88 ("crypto : chtls - CPL handler definition")
Signed-off-by: Vinay Kumar Yadav <[email protected]>
Signed-off-by: Ayush Sawal <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
ayushsawl authored and kuba-moo committed Jan 8, 2021
1 parent eade1e0 commit 15ef6b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2058,9 +2058,9 @@ static void bl_abort_syn_rcv(struct sock *lsk, struct sk_buff *skb)
queue = csk->txq_idx;

skb->sk = NULL;
do_abort_syn_rcv(child, lsk);
chtls_send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev,
CPL_ABORT_NO_RST, queue);
do_abort_syn_rcv(child, lsk);
}

static int abort_syn_rcv(struct sock *sk, struct sk_buff *skb)
Expand Down Expand Up @@ -2090,8 +2090,8 @@ static int abort_syn_rcv(struct sock *sk, struct sk_buff *skb)
if (!sock_owned_by_user(psk)) {
int queue = csk->txq_idx;

do_abort_syn_rcv(sk, psk);
chtls_send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue);
do_abort_syn_rcv(sk, psk);
} else {
skb->sk = sk;
BLOG_SKB_CB(skb)->backlog_rcv = bl_abort_syn_rcv;
Expand Down Expand Up @@ -2135,12 +2135,12 @@ static void chtls_abort_req_rss(struct sock *sk, struct sk_buff *skb)
if (sk->sk_state == TCP_SYN_RECV && !abort_syn_rcv(sk, skb))
return;

chtls_release_resources(sk);
chtls_conn_done(sk);
}

chtls_send_abort_rpl(sk, skb, BLOG_SKB_CB(skb)->cdev,
rst_status, queue);
chtls_release_resources(sk);
chtls_conn_done(sk);
}

static void chtls_abort_rpl_rss(struct sock *sk, struct sk_buff *skb)
Expand Down

0 comments on commit 15ef6b0

Please sign in to comment.