Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp751643ybv; Fri, 7 Feb 2020 07:55:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwpg2te2EvNnQVaHS92FQZQaZW052XCGmevATvVxSs/SYSYLiAP9BF3OAVXCaugrJVkcXXL X-Received: by 2002:aca:3805:: with SMTP id f5mr2564282oia.6.1581090944591; Fri, 07 Feb 2020 07:55:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581090944; cv=none; d=google.com; s=arc-20160816; b=HmBmAywusH7GjOjsTc2X0AyUH9Mw5xEcIbktTcEoVkTzO6dWNAtYGV9zqhGm6Fuxfl p2ShCmFQqrTDsNs8/sWeHp4nTkHMdHBA8Volu54c5pIlfxW89Rk0pyJm1rHb8YTypqr2 ORBZ0TnRfNjwGA2ggltZVNAWtVS3v9vaCWOpcFecLZCN03YlWppbW2/JrdR9CXyIP4D8 oSF0Y+WKr8O+xd0ECGUdc3UjrL+Rsj7MZJ2p76lI5qWM98g3KD05l1BE6pXT6Guh7lN0 ewqOnOZ2bipEebhHviSasPFmmmfjKVqVP7EiYOaKBkbHnVBfwDKIWeDOu+VuTsxccZ4T GQcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xrCSFuR4yeUyXeOZPQTFiDl4JKVQG4uyRkwZKKbSbgU=; b=fz5RxVUXMa7ItRnvf2xROcaFtG5P4hLzN6sQbJttdiIGebTHMKkGajsdJcfhh2Q6pZ xNYgPSDnkLjm2spNBKV/hD45DfqD2pZ8nyn0qlaTQnpKhHhpV6+nfQaKXBERkgwgOk6a DINABlHMNW46Y61feuKkoJBbJtfuF18GZuq5wBWMobnqOzUhy4PclRRtFtneI0MobvVE JTmc1bZTC5+8sWaS9AXp5n/Qtt1pwHWHjGkNfNFJGa38Fm2AwAT5Jb2/VVIE7nagq2wI zhWDfLb8xd4JfwCH0XW8YxGR4T1LR/a2ZKLe3IjfQtxZFYpY2dqFzQ5C5LSD77zIt59w +10A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="t9IRMB/o"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si1657031otr.64.2020.02.07.07.55.31; Fri, 07 Feb 2020 07:55:44 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="t9IRMB/o"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727347AbgBGPyS (ORCPT + 99 others); Fri, 7 Feb 2020 10:54:18 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43486 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726956AbgBGPyQ (ORCPT ); Fri, 7 Feb 2020 10:54:16 -0500 Received: by mail-wr1-f66.google.com with SMTP id z9so3238328wrs.10 for ; Fri, 07 Feb 2020 07:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xrCSFuR4yeUyXeOZPQTFiDl4JKVQG4uyRkwZKKbSbgU=; b=t9IRMB/oirrKmziTViJwNQnoY9zfSbnExbTlr0HdckiYqUKHM5CVq35nabxifMA6Az 7suSvU9VyEVej5gLwzksg0VtH/7Gq6tDZxHew3rS+5oDTs9gFsv2IW0FtBOe+BZs+sgw IcczUezWRXRTdLTkowxFO5R21mjvSHDxB2fxDQ+iIaPbSY+yCvAggmy1FPtX/J8yhA2z 8/vLQ8nwCjfZLGt1QVvV7ZECB1xdRNaKou5qluHAh4l+qV9bmrLnJLSAXSbjbcxxJjxA 5oV/VqNcgz/lcrJI6eL3mbUyLTbLyFUrYDMqaNczbQyHkvlKBV1zLyuHYOkDD1sHeD9e XVbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xrCSFuR4yeUyXeOZPQTFiDl4JKVQG4uyRkwZKKbSbgU=; b=XOgKkTRClYJOzpBaobd0SLHLyca6YdRpdqgRpmmvweSz/gA81TtOzJLd0wAgfeZ5px 7JtVBMZG/8hM446Q7tKns+ZoZi2Xz3u67YqQljyR3f00hgf1boe3gXOuMgKCpQ36ofsB mgW27UOYHA1IRMw9/EoDuhElqc3JN6KB61gnx+S8ShU7LPCI9DP2fja/qZcRRgmAGqde /9uky1ufS/Hwc9S8ntBJnppVV+7euUD6/1LxrlBZhKhMu0RyO9T2BO1CK03OK5em0+f8 /SEkRJKjwnCuXfS0HqWBJZlG1kc1ONmclJ/0fHMA2sDiM1xLAsVbYHCZoEJiolP0I+47 f+xQ== X-Gm-Message-State: APjAAAUFmRczOJtnS7w54u1Uo9nj+DQo1TpyM+dj503/qCSI8DD/XROK kb4EgbcVPbLw05vthZ05bsVCpsKWvm9YcYdqOCg= X-Received: by 2002:a5d:5152:: with SMTP id u18mr5327564wrt.214.1581090854460; Fri, 07 Feb 2020 07:54:14 -0800 (PST) MIME-Version: 1.0 References: <20200114093305.666-1-quanyang.wang@windriver.com> <415718c7-4c55-fb5d-0b10-ad5323daa5a0@windriver.com> In-Reply-To: <415718c7-4c55-fb5d-0b10-ad5323daa5a0@windriver.com> From: Richard Weinberger Date: Fri, 7 Feb 2020 16:54:03 +0100 Message-ID: Subject: Re: [PATCH] ubi: fix memory leak from ubi->fm_anchor To: Quanyang Wang Cc: Richard Weinberger , Miquel Raynal , Vignesh Raghavendra , linux-mtd@lists.infradead.org, LKML , Sascha Hauer Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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