Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1785653rwi; Thu, 3 Nov 2022 09:03:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SpTckxRPXXCLKU45HntzypLuGxRcQbijkMJT0I+ivEcxUiEgnCpOMocPOKSx7xjkQSKUQ X-Received: by 2002:a05:6402:5507:b0:452:183f:16d1 with SMTP id fi7-20020a056402550700b00452183f16d1mr31741273edb.96.1667491417547; Thu, 03 Nov 2022 09:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667491417; cv=none; d=google.com; s=arc-20160816; b=N2WNgYe1PEJrCPXIBJvEK8IbxDVWl8XouzmNimmDtFZNhy8ArdbDlMduBQwiMSCZfL dePXVOuX9HL4Sawn1zrp4PgCYZoa9wGOn8MQl1jvaQ1PVMsv2w5hElIWJq++qs+4gJ8R fVWTPh97rLkp4OL0xtcE0lVO7tKiishBf0PTzzqoN0gIllBqZDgDaJZlMhkhTMRMWy2S /HpOS4glhGJUBMUKBz/XDpGNpQKs4Fx6rhjY/a4xid8Ek10VNlH2iNRz3qyTpK+x6T7R +Wa+VdTPy7y4seDAUxI0vr1/YUSfW71o6ud59sXzT8q0RY9OrvZk71MUZKEo1NRXdjwi f4gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=3h//HlIguXJZhRdiiWfRY76v7ffmrOuFdbIoPsc2yf0=; b=TGCsn2X23jlc3FJUSPUsHlIJ+bogs1ynSOMQjHSyQPNi58HDHqsInV94ax4UP9bpwm mwDhaxrjSWCTbWnwMeYjxKbSOPq91p7ff5pgSTeHW5nDu7hEtslcWfDt7f61tAJit0SN 4Y+eEfMZ8sDGlFWJcCNm32Os+8l7LlwJvM3kXKKlIabD5NO3DkmNOlGdDexhY2KIMVqs pOLVefZOJxApXez08y8Jg6gDi+BYl4LdAKN5nnUKYsCIfA2RRJ3sSoGWMeAWEkovOQuH PgTXI1ez5asFlwkpUBwfpJhXjsoZahWY7skOokDUMOUnAtLqaZ0UMhxq0iLTW5v08/HQ BbRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vMI7YSyD; 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 l22-20020a170906795600b0078103b6f8cbsi1937352ejo.318.2022.11.03.09.02.56; Thu, 03 Nov 2022 09:03:37 -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=vMI7YSyD; 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 S231320AbiKCPf2 (ORCPT + 97 others); Thu, 3 Nov 2022 11:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiKCPf1 (ORCPT ); Thu, 3 Nov 2022 11:35:27 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2903A12618; Thu, 3 Nov 2022 08:35:27 -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 DB29F1F385; Thu, 3 Nov 2022 15:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1667489725; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3h//HlIguXJZhRdiiWfRY76v7ffmrOuFdbIoPsc2yf0=; b=vMI7YSyDMTLJWTmD4jWd5L2nt96lEOeopCxI4R38AQcxm0l7hX8wMjBKICrSJArEczGuNk Lc9HM8vv6+c4i+EKit6cHdgc4y6+3E9hHjOoZ4IxjjhUX+AjyPPToyyE7s/Lmnlb5hNlVD PytEXPlL9XQHYRObkHF/3nkn3/lWgfQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1667489725; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3h//HlIguXJZhRdiiWfRY76v7ffmrOuFdbIoPsc2yf0=; b=fZ33pnkYNIh7EzdZMBC7XhcXM9L3Gw5ajU3mgQfSTDn2XyY+NIJwbocyW0MEY2ziMgCH+L qb16Aqp2AuSlZ2CQ== 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 763D913480; Thu, 3 Nov 2022 15:35:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JZ/kGb3fY2N/JgAAMHmgww (envelope-from ); Thu, 03 Nov 2022 15:35:25 +0000 Received: from localhost (brahms.olymp [local]) by brahms.olymp (OpenSMTPD) with ESMTPA id 3d1d2e61; Thu, 3 Nov 2022 15:36:25 +0000 (UTC) From: =?UTF-8?q?Lu=C3=ADs=20Henriques?= To: Xiubo Li , Ilya Dryomov , Jeff Layton Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Lu=C3=ADs=20Henriques?= Subject: [PATCH] ceph: fix memory leak in mount error path when using test_dummy_encryption Date: Thu, 3 Nov 2022 15:36:19 +0000 Message-Id: <20221103153619.11068-1-lhenriques@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 Because ceph_init_fs_context() will never be invoced in case we get a mount error, destroy_mount_options() won't be releasing fscrypt resources with fscrypt_free_dummy_policy(). This will result in a memory leak. Add an invocation to this function in the mount error path. Signed-off-by: Luís Henriques --- fs/ceph/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 2224d44d21c0..6b9fd04b25cd 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1362,6 +1362,7 @@ static int ceph_get_tree(struct fs_context *fc) ceph_mdsc_close_sessions(fsc->mdsc); deactivate_locked_super(sb); + fscrypt_free_dummy_policy(&fsc->fsc_dummy_enc_policy); goto out_final; out: