]> git.baikalelectronics.ru Git - kernel.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)
commit8d4b2f504a86452725b4353aa0ca1b9cedfa20bc
tree144ae9078e32df6662652778621ae439c3677ad0
parentf7ca7fc68fbcdc5a745dabb63f276cb3b5e6cbda
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