Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1320185ybv; Fri, 7 Feb 2020 19:10:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzBaWe8ZvorE/9G1gownEIuWa/dhsZm0fSiSdGlJWiyF92lY6MWvT234AUgqRp5eOQvUZn0 X-Received: by 2002:a05:6830:1149:: with SMTP id x9mr2045334otq.156.1581131405041; Fri, 07 Feb 2020 19:10:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581131405; cv=none; d=google.com; s=arc-20160816; b=IWQ3Ugx5qxDrKp5L+hKLEjb2soL74qNOjwd4w/5KFsjX32B5ikKIX8wHvLJ0VZspWZ ZQSc4rHK/XsCgHjo3QoFDFkLfEQkbo2mZxpoybZIbzzaAnGH7nagP+6xz73RPGwyLe6X y1CfmcYJtvxwZJxo55cbRmMbKL9d0H4hgWPCHOG13/L5nZ/GTxUtPa4v94DOs+RC2SUV dyWrrv0rgzRnYUn1dvog09bUcziDIkPvxC1NPbeic10clJpHugs8SHKvgRnmCyecAQ2L HkEKhOhxGVYZg0PLSIyoTJoze+MrIdCsSzsWZG3po1j13FU1BC5q9UBqMt+z6QvQOX/R Igfg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=dZ4kCYp7ewLKHnYNecK95wKEapT6FymzdBrwG5D5G9c=; b=Ld8rINWAgXnBc0MSGkfG72TFTwndNLA+Lw1VXdmhsJgP4p+NFGMIVJyuh3Otq80zv/ SQEIyize5ioagFYNd+OajXHQnfGr5JZTDo+BAOFw98JnD8J9YwcI5/1s5RkbQWX/xqpD dQNjdBBHs5V2+W8BlglQzzmjCexpuwpKHl5ok4UamkMyh4ndkwRZIdeULBMPZaG6ZHLg OBQSS3XMFkeAijfCM5NtAQz0Vkg7FFNgOXrLmze3V/vBH2k11ffXlXJ8cWRsKBjhE7ID /lfgU5Gt7sZtuEP/UsMxuXlGP1bzJR/RwZFccMeIbNjXZhyS3noVnEpsVVA2UUkMpVUQ hHOA== ARC-Authentication-Results: i=1; mx.google.com; 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 94si739260otw.297.2020.02.07.19.09.16; Fri, 07 Feb 2020 19:10:05 -0800 (PST) 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; 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 S1727131AbgBHDAT (ORCPT + 99 others); Fri, 7 Feb 2020 22:00:19 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:48306 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726743AbgBHDAT (ORCPT ); Fri, 7 Feb 2020 22:00:19 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 383721DB7146CE327F82; Sat, 8 Feb 2020 11:00:17 +0800 (CST) Received: from [127.0.0.1] (10.133.219.224) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Sat, 8 Feb 2020 11:00:16 +0800 Subject: Re: [PATCH] ubi: fix memory leak from ubi->fm_anchor To: Richard Weinberger , Quanyang Wang CC: Vignesh Raghavendra , Richard Weinberger , Sascha Hauer , LKML , , "Miquel Raynal" References: <20200114093305.666-1-quanyang.wang@windriver.com> <415718c7-4c55-fb5d-0b10-ad5323daa5a0@windriver.com> From: Hou Tao Message-ID: Date: Sat, 8 Feb 2020 11:00:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.133.219.224] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, The same problem has already been fixed by the patch in the following link early: https://lore.kernel.org/linux-mtd/0000000000006d0a820599366088@google.com/T/#medffabe29b65eb5feb387bff84c6ec7ad235c310 I will send a v2 next week. Regards, Tao On 2020/2/7 23:54, Richard Weinberger wrote: > On Mon, Feb 3, 2020 at 10:14 AM Quanyang Wang > wrote: >> >> Ping? >> >> On 1/14/20 5:33 PM, quanyang.wang@windriver.com wrote: >>> From: Quanyang Wang >>> >>> Some ubi_wl_entry are allocated in erase_aeb() and one of them is >>> assigned to ubi->fm_anchor in __erase_worker(). And it should be freed >>> like others which are freed in tree_destroy(). Otherwise, it will >>> cause a memory leak: >>> >>> unreferenced object 0xbc094318 (size 24): >>> comm "ubiattach", pid 491, jiffies 4294954015 (age 420.110s) >>> hex dump (first 24 bytes): >>> 30 43 09 bc 00 00 00 00 00 00 00 00 01 00 00 00 0C.............. >>> 02 00 00 00 04 00 00 00 ........ >>> backtrace: >>> [<6c2d5089>] erase_aeb+0x28/0xc8 >>> [] ubi_wl_init+0x1d8/0x4a8 >>> [] ubi_attach+0xffc/0x10d0 >>> [] ubi_attach_mtd_dev+0x5b4/0x9fc >>> [] ctrl_cdev_ioctl+0xb8/0x1d8 >>> [<72b250f2>] vfs_ioctl+0x28/0x3c >>> [] do_vfs_ioctl+0xb0/0x798 >>> [] ksys_ioctl+0x58/0x74 >>> [<5355bdbe>] ret_fast_syscall+0x0/0x54 >>> [<90c6c3ca>] 0x7eadf854 >>> >>> Signed-off-by: Quanyang Wang >>> --- >>> drivers/mtd/ubi/wl.c | 2 ++ >>> 1 file changed, 2 insertions(+) > > Good catch! > Fixes: f9c34bb52997 ("ubi: Fix producing anchor PEBs") > > --- > Thanks, > //richard > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ > >