From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8294CC4167B for ; Mon, 27 Nov 2023 10:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233045AbjK0KmW (ORCPT ); Mon, 27 Nov 2023 05:42:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233090AbjK0KmN (ORCPT ); Mon, 27 Nov 2023 05:42:13 -0500 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F43819A for ; Mon, 27 Nov 2023 02:42:13 -0800 (PST) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4Sf2GB1VjKz1qtrG; Mon, 27 Nov 2023 11:42:10 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4Sf2GB03Yzz1qqlc; Mon, 27 Nov 2023 11:42:09 +0100 (CET) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id tm617zSg7y19; Mon, 27 Nov 2023 11:42:09 +0100 (CET) X-Auth-Info: +DnrhnZblEGlOzb3XeBn1Jt2rs2WUKWMccr42/2aPU5JxxGUkqgQeHc3hbITbzys Received: from igel.home (aftr-62-216-205-201.dynamic.mnet-online.de [62.216.205.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 27 Nov 2023 11:42:09 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id CE2AA2C1CD6; Mon, 27 Nov 2023 11:42:08 +0100 (CET) From: Andreas Schwab To: Charlie Jenkins Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Ron Economos , Samuel Holland , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] riscv: Safely remove entries from relocation list In-Reply-To: <20231122-module_linking_freeing-v3-1-8e9e412a3305@rivosinc.com> (Charlie Jenkins's message of "Wed, 22 Nov 2023 15:31:41 -0800") References: <20231122-module_linking_freeing-v3-0-8e9e412a3305@rivosinc.com> <20231122-module_linking_freeing-v3-1-8e9e412a3305@rivosinc.com> X-Yow: Are we live or on tape? Date: Mon, 27 Nov 2023 11:42:08 +0100 Message-ID: <87bkbfzddr.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Nov 22 2023, Charlie Jenkins wrote: > @@ -683,17 +700,29 @@ int add_relocation_to_accumulate(struct module *me, int type, void *location, > > if (!found) { > rel_head = kmalloc(sizeof(*rel_head), GFP_KERNEL); > + > + if (!rel_head) > + return -ENOMEM; > + > rel_head->rel_entry = > kmalloc(sizeof(struct list_head), GFP_KERNEL); > + > + if (!rel_head->rel_entry) > + return -ENOMEM; This leaks rel_head on error. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."