From patchwork Fri Jan 24 01:13:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 233334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A21B5C35240 for ; Fri, 24 Jan 2020 01:13:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6477921D7D for ; Fri, 24 Jan 2020 01:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579828388; bh=JZiZj6CM0kY9lcelR5oriFf8LmulmZESGOYyueW9opE=; h=Date:From:To:Subject:List-ID:From; b=iTUcfMOKh8NZDvoOb4KvJEEG42br5ZbyFUvS4rxK66gBL6Jju9cHpdyKK9pMvBegt 7Purm1b2yMDnHm42Ea0ggqlr0uhf2P/+mbg0ITNeOPTqHJDbLmR2/ko+Ev4kBEjazQ z+V4hwWTl1ziLv/OLIwb9OgeiKtVkwJWiTNfOjj8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730275AbgAXBNI (ORCPT ); Thu, 23 Jan 2020 20:13:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:59608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729752AbgAXBNH (ORCPT ); Thu, 23 Jan 2020 20:13:07 -0500 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5B502087E; Fri, 24 Jan 2020 01:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579828386; bh=JZiZj6CM0kY9lcelR5oriFf8LmulmZESGOYyueW9opE=; h=Date:From:To:Subject:From; b=qLGp3YaFz6HcXCGShcjGV29j+tWLTHP0f+RF//rA8cbH4p0MtRaw1NWZV7tZjJkGk tKNQpiUElfQjg5vV5SWQE5CrktFetrI+xvgsiGn9fGsvDkdFrReokMVWQnfbHIlEOo OEVCg/CZLPFAi6vMW9GlRsCr/xZpFHzc+bqQOT2c= Date: Thu, 23 Jan 2020 17:13:06 -0800 From: akpm@linux-foundation.org To: dvyukov@google.com, gustavo@embeddedor.com, mm-commits@vger.kernel.org, stable@vger.kernel.org Subject: + lib-test_kasanc-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch added to -mm tree Message-ID: <20200124011306.7Bu7OgvYd%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch titled Subject: lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more() has been added to the -mm tree. Its filename is lib-test_kasanc-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-test_kasanc-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-test_kasanc-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Gustavo A. R. Silva" Subject: lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more() In case memory resources for _ptr2_ were allocated, release them before return. Notice that in case _ptr1_ happens to be NULL, krealloc() behaves exactly like kmalloc(). Addresses-Coverity-ID: 1490594 ("Resource leak") Link: http://lkml.kernel.org/r/20200123160115.GA4202@embeddedor Fixes: 3f15801cdc23 ("lib: add kasan test module") Signed-off-by: Gustavo A. R. Silva Reviewed-by: Dmitry Vyukov Cc: Signed-off-by: Andrew Morton --- lib/test_kasan.c | 1 + 1 file changed, 1 insertion(+) --- a/lib/test_kasan.c~lib-test_kasanc-fix-memory-leak-in-kmalloc_oob_krealloc_more +++ a/lib/test_kasan.c @@ -158,6 +158,7 @@ static noinline void __init kmalloc_oob_ if (!ptr1 || !ptr2) { pr_err("Allocation failed\n"); kfree(ptr1); + kfree(ptr2); return; }