staging: lustre: libcfs: bug fixes for cfs_crypto_hash_final()
authorAndreas Dilger <andreas.dilger@intel.com>
Sat, 26 Mar 2016 19:40:51 +0000 (15:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Mar 2016 19:06:51 +0000 (12:06 -0700)
commitc11e27a4ee39479b9afef86bfed8ef3f75756262
treec75ebc6ba5a85698e5c929d2160b63ffa5037a46
parent244cd87cc078fd18a8cbbb4db2998b95760007f6
staging: lustre: libcfs: bug fixes for cfs_crypto_hash_final()

Change cfs_crypto_hash_final() to always clean up the hash descrptor
instead of not doing this in error cases.  All of the callers were
just calling cfs_crypto_hash_final() immediately to clean up the
descriptor anyway, and the old behaviour is unlike other init/fini
functions, and prone to memory leaks and other incorrect usage.  The
callers can call cfs_crypto_digest_size() to determine the hash size
in advance if needed, and avoid complexity in cfs_crypto_hash_final().

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
drivers/staging/lustre/lustre/osc/osc_request.c
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c