Skip to content

Commit

Permalink
crypto: algif_aead - Fix kernel panic on list_del
Browse files Browse the repository at this point in the history
Kernel panics when userspace program try to access AEAD interface.
Remove node from Linked List before freeing its memory.

Cc: <[email protected]>
Signed-off-by: Harsh Jain <[email protected]>
Reviewed-by: Stephan Müller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Harsh Jain authored and herbertx committed Feb 3, 2017
1 parent c268199 commit 0b529f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/algif_aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,9 @@ static int aead_recvmsg_sync(struct socket *sock, struct msghdr *msg, int flags)
unlock:
list_for_each_entry_safe(rsgl, tmp, &ctx->list, list) {
af_alg_free_sg(&rsgl->sgl);
list_del(&rsgl->list);
if (rsgl != &ctx->first_rsgl)
sock_kfree_s(sk, rsgl, sizeof(*rsgl));
list_del(&rsgl->list);
}
INIT_LIST_HEAD(&ctx->list);
aead_wmem_wakeup(sk);
Expand Down

0 comments on commit 0b529f1

Please sign in to comment.