Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3285888ybb; Tue, 31 Mar 2020 02:06:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vve4cyxLL5PmxXhd510xITHDuDQkrui7UGfbwWJ4gZnuQqyp/jUVz/d4dx0wCOBZYKgoxpE X-Received: by 2002:a4a:db7b:: with SMTP id o27mr12594232ood.25.1585645607530; Tue, 31 Mar 2020 02:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645607; cv=none; d=google.com; s=arc-20160816; b=mfXnGsgQG21qxEwUoc6p8hRThQsjJJwETp28JZJL2GBF6qUySF8hoKy8iDSN7Yee2Z wPoas6lKFk1xRTSaUWq4w3ajKqGCDF0gcBZ3HM7CkEsp3EADl/t0mYMpJqSWjPLdKgxU xWl7oYDoxRvS0uvhmFG7q9SA3qwJfHn9ZB4iTAmhzIynZg2ruPvAtRnY+aoY9BClRqFG EFZO1Ih+77BYx2hhZDHwcAhMGD+PJl+6hBmqAF7irZIKd8FD6Su0um0sjW04bSA6seWh 8tF6dQvyGmNz03ufKvZ6GneqCZVgUhRhW1NDI/KP/mj2eZlaWRixBP0OVH5m1snWzSWs nLnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eUzuUaDCwmMGMRg8IYumRjg8Q9ym5w63/vQErgpPHPM=; b=yMKahucizL5C4KFgl+emklwigZS13nnN0uYH/52Cda0bU7+MZObwh555cs5tUVgfTn vu9uMBjyJfdthUPFTd4lzxyVZ3cAJDf16M08IIz/bu5O0fceDVOf3H4n/82oe4und9xE qzeeIWZU7Mk7bf9GgickQn85Ce86W4QQ3nlXWMNMwMBIFeOrCIJ0yj+j6uVB42whnf5P c9iyXCTcGmL7sex/oET+TWQXvATNnCmDc25VtlCWfeJ5+BryXjs4YgLD/CuGwhcEHPIN AbAf7KmoOmDULw0TMQHJZTWh4qqLm/NExCqFXPQKX1oU5GLWbrsqs9NJYQI2892j1+Qx YeDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FkH6Rcw2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si7605829oiy.229.2020.03.31.02.06.35; Tue, 31 Mar 2020 02:06:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FkH6Rcw2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731114AbgCaJGO (ORCPT + 99 others); Tue, 31 Mar 2020 05:06:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:47462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731110AbgCaJGI (ORCPT ); Tue, 31 Mar 2020 05:06:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 DC84C20787; Tue, 31 Mar 2020 09:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645568; bh=CY/wbAodfT00hdTU5A7Rz1+tsKBLLbSu1NJDFYyHIy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FkH6Rcw2MUV99AvSWg6ncCRUrE0xgka55sihZufwHL7w2pIAPIqyyj8xnGv+4kwUW ed1dYstZM8jlpcSjYrfG7cnHJFWa9jxGemOk2l0rfZMjf/+wV/LonI/s2824myKJ4I yLC0wnQEHB05WkOCdtecqJW5/b4lXMgmE/vyJzeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luis Henriques , Jeff Layton , Ilya Dryomov Subject: [PATCH 5.5 093/170] ceph: fix memory leak in ceph_cleanup_snapid_map() Date: Tue, 31 Mar 2020 10:58:27 +0200 Message-Id: <20200331085434.134918164@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luis Henriques commit c8d6ee01449cd0d2f30410681cccb616a88f50b1 upstream. kmemleak reports the following memory leak: unreferenced object 0xffff88821feac8a0 (size 96): comm "kworker/1:0", pid 17, jiffies 4294896362 (age 20.512s) hex dump (first 32 bytes): a0 c8 ea 1f 82 88 ff ff 00 c9 ea 1f 82 88 ff ff ................ 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ad de ................ backtrace: [<00000000b3ea77fb>] ceph_get_snapid_map+0x75/0x2a0 [<00000000d4060942>] fill_inode+0xb26/0x1010 [<0000000049da6206>] ceph_readdir_prepopulate+0x389/0xc40 [<00000000e2fe2549>] dispatch+0x11ab/0x1521 [<000000007700b894>] ceph_con_workfn+0xf3d/0x3240 [<0000000039138a41>] process_one_work+0x24d/0x590 [<00000000eb751f34>] worker_thread+0x4a/0x3d0 [<000000007e8f0d42>] kthread+0xfb/0x130 [<00000000d49bd1fa>] ret_from_fork+0x3a/0x50 A kfree is missing while looping the 'to_free' list of ceph_snapid_map objects. Cc: stable@vger.kernel.org Fixes: 75c9627efb72 ("ceph: map snapid to anonymous bdev ID") Signed-off-by: Luis Henriques Reviewed-by: Jeff Layton Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- fs/ceph/snap.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c @@ -1155,5 +1155,6 @@ void ceph_cleanup_snapid_map(struct ceph pr_err("snapid map %llx -> %x still in use\n", sm->snap, sm->dev); } + kfree(sm); } }