Skip to content

Commit

Permalink
[CRYPTO] xcbc: Fix algorithm leak when block size check fails
Browse files Browse the repository at this point in the history
When the underlying algorithm has a block size other than 16 we abort
without freeing it.  In fact, we try to return the algorithm itself
as an error!

This patch plugs the leak and makes it return -EINVAL instead.

Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jan 10, 2008
1 parent 2a999a3 commit 1b87887
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/xcbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ static struct crypto_instance *xcbc_alloc(struct rtattr **tb)
case 16:
break;
default:
return ERR_PTR(PTR_ERR(alg));
inst = ERR_PTR(-EINVAL);
goto out_put_alg;
}

inst = crypto_alloc_instance("xcbc", alg);
Expand Down

0 comments on commit 1b87887

Please sign in to comment.