Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2908372rdb; Mon, 4 Dec 2023 10:42:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxh3aBdD8GHjmPknL5qqEqvz73BZ96l5tMVjv5olrXRD4/qEs5Gge/LxRlwqJg556uotni X-Received: by 2002:a05:6a20:3944:b0:18b:3168:d1a1 with SMTP id r4-20020a056a20394400b0018b3168d1a1mr2805982pzg.46.1701715329662; Mon, 04 Dec 2023 10:42:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701715329; cv=none; d=google.com; s=arc-20160816; b=ogQE481qo7stFZ9QD9Yp8W2vXeDuFtyPb7XByMZnQbAV+2gQkZ5xJ3hLyGbdyN7IHb xnsTYnEKVcQueZjPNToW39rp7+ATmQPX2qYZFwF8/kpmEG6cUw2rLELclloMd8cNaYfq 35H3Q7EG2p2MJqBRFLnOVwvqopQ0+jHCK8JOV7BFb/WZYgdj0ag09i0K6d9whdFGsAPa 5g8qZPYJSukmCshWrD1wGUFr5yR22Ud3sMJucW9t4gTSAwuq5uQwTOg02BIbVniEoStd 7gMiuFaLKKlbVbHLUcPolwflTKj1NxBJRlq+wHztOkj4aYejXj+SWHjOKAHctUwRCrzw pVKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JwMqSnGo4QDjm2pjAxkXN4dZgMZZOVKqtY+jomMdbrk=; fh=ss4F0nPqGDNYPO6RvY5q7cnbqpgj8WMGRWkttnQV+rU=; b=yhhXFwkswoh+PvkVkBQR687XVAWEQgZ/O3sioC3Qj1NalHHW4/Ra4B9pr26n6DkXec 15c5LrdcgmEJ63+WT4mcMNwHYhxThYjm7GfINjtk9uH7SJvShQVN7YenXJXoHDrI4V8Q e5dkHsqbeHPYpRxb6lCUQ2q6bVB0jRBaBEax0RyQYKirF7H94v4p4TqD6vuVmMXleUnt 6iu0Eq+cKegGQx3rqFt8v2P5iOVK3tjykecGrx47/3Pet17F6gWb0BBLjfxvjcrb8Od9 WC4XLZ+W5ym9a/tyb/J3bGr2Ak5F1pdJ5wjM9kZBMWhvRG5aIizn5oHNlFWfj3YnB1QJ Bc/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=3O97Yzbl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n189-20020a6327c6000000b005c6818b5a28si2622539pgn.517.2023.12.04.10.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:42:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=3O97Yzbl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 15B73804C611; Mon, 4 Dec 2023 10:42:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232223AbjLDSl6 (ORCPT + 99 others); Mon, 4 Dec 2023 13:41:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbjLDSl5 (ORCPT ); Mon, 4 Dec 2023 13:41:57 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75127FA for ; Mon, 4 Dec 2023 10:42:03 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6cbe716b511so3645618b3a.3 for ; Mon, 04 Dec 2023 10:42:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1701715323; x=1702320123; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JwMqSnGo4QDjm2pjAxkXN4dZgMZZOVKqtY+jomMdbrk=; b=3O97Yzblkyul4rL0GZ9xmqurBw508llq3Otj/rv5MDRvqBDkwaeSdXnG0QsgvYhToZ fUDYE3f7vg9n2chE2pyNDZLLk/u+4oSOArLgLNcBQvCHgpBQWKvws15ON2f0jvzyzRtI zFUi6wdO2W9udTo+oz0p20S4TueEI/+MOlHLmmhTp7xfa6OQ32chdVB5lgl1HZq9xxS0 zCUWAQruOjmvXO5aG9OSr48iQo6npUgoeV6E+kq/I4DgOfN0hutf8jGrFPtR724cPnPX VLlI67djac5Oq/TJN2wov1X9u0zzPV5TJSeVVK5vwSKvOJAWajwgn7HPLKn3XiudI2Q0 rqTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701715323; x=1702320123; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JwMqSnGo4QDjm2pjAxkXN4dZgMZZOVKqtY+jomMdbrk=; b=K1HiTWCVAQgFCPpLOT2BRaBSl2zNp5/oMtgK5f8y+lG1ph0mHYrZpnRpP11G4q/004 TPl3MCDhQfOD2tAsr3jBERrCdPqO6UjTfbbKJF+fK2bTO4c48Cs3o0ybZCm9cUrkD+g4 CNwx49tAnvhU+DTiOm4vpi76UvtKJ5AxsIvu9QzHAbycEBCNgcyXJR6vboSybbK4th1p kfYK4lc6Ua2bH/7MFlko+QKM+p/CUHf+CufYbE5Jq1EoEk/PrKXbvSdhXgpTVvn/nMpJ SVW5NcaCCSaoPJooSOGZSEyzW/NrNfdyHUa4O7/PLqpcL+NeFxqANYGbuQgGN7wR3l4h Afdg== X-Gm-Message-State: AOJu0YyoRnnsEAMqfbajbl6SvyJIXUpt0YccRvP7/deQJT7XdDfKFzSF 33Z/bXjpWu2LMZ0Vd2NcYTG12g== X-Received: by 2002:a05:6a00:340f:b0:6ce:58d3:34ee with SMTP id cn15-20020a056a00340f00b006ce58d334eemr2724pfb.30.1701715322912; Mon, 04 Dec 2023 10:42:02 -0800 (PST) Received: from ghost ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id j8-20020aa783c8000000b006c320b9897fsm7954921pfn.126.2023.12.04.10.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:42:02 -0800 (PST) Date: Mon, 4 Dec 2023 10:42:00 -0800 From: Charlie Jenkins To: Andreas Schwab 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 Message-ID: References: <20231122-module_linking_freeing-v3-0-8e9e412a3305@rivosinc.com> <20231122-module_linking_freeing-v3-1-8e9e412a3305@rivosinc.com> <87bkbfzddr.fsf@igel.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bkbfzddr.fsf@igel.home> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 10:42:08 -0800 (PST) On Mon, Nov 27, 2023 at 11:42:08AM +0100, Andreas Schwab wrote: > 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." Thank you for pointing this out, I fixed this issue in the next version but forgot to respond to this thread. https://lore.kernel.org/linux-riscv/20231127-module_linking_freeing-v4-1-a2ca1d7027d0@rivosinc.com/ - Charlie