Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2369942rwl; Thu, 30 Mar 2023 09:21:08 -0700 (PDT) X-Google-Smtp-Source: AKy350aWoo2mMkP9IN2bQq4JrOHkXHLbpuj6K2PVSxfGEM4xqlE+X5DTo0Nj/xA2YEJXjXw2AFdu X-Received: by 2002:a05:6402:1e93:b0:501:ea97:5192 with SMTP id f19-20020a0564021e9300b00501ea975192mr26139141edf.4.1680193268606; Thu, 30 Mar 2023 09:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680193268; cv=none; d=google.com; s=arc-20160816; b=Wu70nP98yWyrBGvf/9oQyPA8tlYekkxuElfbcUBy1UzCN135ZxTCY5DOmjA26sKEE+ uAlkeINicWmP5sdi29pwRjGXuc8Bwxo0gNxa9h8CwZDGCYATJ/F5M6XqUAF6B/nBWAUO q4zLf6xiebLwmlt22RZgpYy1/yMrHceEkIZKweSbRItXGomCfsu4pPf8dqIVhbYs6FYH 9bSg9Hv4ULzOZNKpCophbdowro2C0fNJWNRTG8pSOZhTOrvgRMbK6bo2AogAKQGjs5Kz CZ0Hxbqw0EvDH3gfUQGrwk04dCgCCxbHU4StGg5CP2Xzd0FPmouYfd9EIRivrbTgP4gU XpRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=HMiVIJW7f8S+buhdtTbu84jXewIpExbZfY0s1xagWoQ=; b=bMYq/93aSUtSBsZksplfJJpgSFDAOFmwsz58DgZXZTTb2RRFtBjqhv+Z3POfET/yLc Oqjew0fCugO4DY48gl2OrC0/BYHuuOIJt6CkVzoNC9JOlszN1VBaTBoFyFDiKg24tjTW vSTVg/Ct1zzYFrOc+uD0q6f7eHGdlW/upaaikRehhwHTvFA15XSsZLInLgswF//pS1Ap SMM153AlynS2KdAsybagL7n1eX6iN+Qmbmm5pYJ9Eal/hToCIxbjnOh3lVROwpxU9gT9 7MRX5TXJtXgtWHj7fDomNGPZk+sut1bZGrHs14eZB0iHVyWHEfFUtlg/mBge7U0wvMv6 jDUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=2C3lUp1A; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020aa7cfca000000b004a18f2ffb81si121180edy.321.2023.03.30.09.20.27; Thu, 30 Mar 2023 09:21:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=2C3lUp1A; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230101AbjC3QB7 (ORCPT + 99 others); Thu, 30 Mar 2023 12:01:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjC3QB6 (ORCPT ); Thu, 30 Mar 2023 12:01:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 167CB7EC3; Thu, 30 Mar 2023 09:01:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B7E751FE12; Thu, 30 Mar 2023 16:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680192115; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HMiVIJW7f8S+buhdtTbu84jXewIpExbZfY0s1xagWoQ=; b=2C3lUp1AXCO17ZcJ5VuyBB2i28gJymGs2Xa4KbOX4HklqQ1wzH7ctS0kOQP2CXm53DtyFl Y53kpRy9Gh6SLmk3MwiR9s8TmDPvMcuqUVl7S/T0qvRxFl7tNxgVqx5eQVkUhTRy7sEcgX /82RGFjATGQGiKF8gagLz1QD9bztgJE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680192115; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HMiVIJW7f8S+buhdtTbu84jXewIpExbZfY0s1xagWoQ=; b=RToNAL86t/p9McMUf/jMopqPC3J5NcMaRaVnci1D7WewRovpnWwII7kR+GWMIFM+6zi6mQ AQg686sYbBzJkjDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7D5241348E; Thu, 30 Mar 2023 16:01:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 20mwHXOyJWSfXQAAMHmgww (envelope-from ); Thu, 30 Mar 2023 16:01:55 +0000 Date: Thu, 30 Mar 2023 18:01:54 +0200 Message-ID: <878rfekz2l.wl-tiwai@suse.de> From: Takashi Iwai To: Dan Carpenter Cc: Mirsad Todorovac , Luis Chamberlain , linux-kselftest@vger.kernel.org, LKML , Greg Kroah-Hartman , Russ Weight , Takashi Iwai , Tianfei zhang , Shuah Khan , Colin Ian King , Randy Dunlap Subject: Re: [BUG] [PATCH RFC v2] selftests/firmware: copious kernel memory leaks in test_fw_run_batch_request() In-Reply-To: <5b103196-68d0-4d42-aa66-779af4d78532@kili.mountain> References: <97e284be-5018-9d18-feb2-7ec4b08c06fd@alu.unizg.hr> <26fd581a-1b9f-4960-8457-61d725511cee@kili.mountain> <5b103196-68d0-4d42-aa66-779af4d78532@kili.mountain> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On Thu, 30 Mar 2023 17:44:42 +0200, Dan Carpenter wrote: > > I admire your enthusiam. :) What about if we just did this? Does it > help with the leaks? > > regards, > dan carpenter > > diff --git a/lib/test_firmware.c b/lib/test_firmware.c > index 05ed84c2fc4c..626b836895f4 100644 > --- a/lib/test_firmware.c > +++ b/lib/test_firmware.c > @@ -895,6 +895,9 @@ static ssize_t trigger_batched_requests_store(struct device *dev, > > mutex_lock(&test_fw_mutex); > > + if (test_fw_config->reqs) > + return -EBUSY; > + This leaves the mutex locked. It should be the following instead, I suppose? if (test_fw_config->reqs) { rc = -EBUSY; goto out_unlock; } Takashi