]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
firmware: Google VPD: Fix memory allocation error handling
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 5 May 2017 19:08:44 +0000 (21:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 May 2017 15:01:46 +0000 (17:01 +0200)
commit9434cec130a941e8a0698d598dfa5499dbdeb949
tree144ae9078e32df6662652778621ae439c3677ad0
parentb299cde245b0b76c977f4291162cf668e087b408
firmware: Google VPD: Fix memory allocation error handling

This patch fixes several issues:
   - if the 1st 'kzalloc' fails, we dereference a NULL pointer
   - if the 2nd 'kzalloc' fails, there is a memory leak
   - if 'sysfs_create_bin_file' fails there is also a memory leak

Fix it by adding a test after the first memory allocation and some error
handling paths to correctly free memory if needed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/google/vpd.c