From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:57394 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbeBANNb (ORCPT ); Thu, 1 Feb 2018 08:13:31 -0500 Subject: Patch "i2c: i2c-boardinfo: fix memory leaks on devinfo" has been added to the 4.14-stable tree To: colin.king@canonical.com, alexander.levin@verizon.com, gregkh@linuxfoundation.org, wsa@the-dreams.de Cc: , From: Date: Thu, 01 Feb 2018 14:12:29 +0100 Message-ID: <151749074917399@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled i2c: i2c-boardinfo: fix memory leaks on devinfo to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: i2c-i2c-boardinfo-fix-memory-leaks-on-devinfo.patch and it can be found in the queue-4.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From foo@baz Thu Feb 1 13:45:42 CET 2018 From: Colin Ian King Date: Wed, 22 Nov 2017 17:52:24 +0000 Subject: i2c: i2c-boardinfo: fix memory leaks on devinfo From: Colin Ian King [ Upstream commit 66a7c84d677e8e4a5a2ef4afdb9bd52e1399a866 ] Currently when an error occurs devinfo is still allocated but is unused when the error exit paths break out of the for-loop. Fix this by kfree'ing devinfo to avoid the leak. Detected by CoverityScan, CID#1416590 ("Resource Leak") Fixes: 4124c4eba402 ("i2c: allow attaching IRQ resources to i2c_board_info") Fixes: 0daaf99d8424 ("i2c: copy device properties when using i2c_register_board_info()") Signed-off-by: Colin Ian King Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/i2c-boardinfo.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/i2c/i2c-boardinfo.c +++ b/drivers/i2c/i2c-boardinfo.c @@ -86,6 +86,7 @@ int i2c_register_board_info(int busnum, property_entries_dup(info->properties); if (IS_ERR(devinfo->board_info.properties)) { status = PTR_ERR(devinfo->board_info.properties); + kfree(devinfo); break; } } @@ -98,6 +99,7 @@ int i2c_register_board_info(int busnum, GFP_KERNEL); if (!devinfo->board_info.resources) { status = -ENOMEM; + kfree(devinfo); break; } } Patches currently in stable-queue which might be from colin.king@canonical.com are queue-4.14/i2c-i2c-boardinfo-fix-memory-leaks-on-devinfo.patch queue-4.14/usb-gadget-don-t-dereference-g-until-after-it-has-been-null-checked.patch