From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7EFFC28CBC for ; Sat, 9 May 2020 19:10:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEB94208E4 for ; Sat, 9 May 2020 19:10:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ic2jDBAU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728187AbgEITKt (ORCPT ); Sat, 9 May 2020 15:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727938AbgEITKt (ORCPT ); Sat, 9 May 2020 15:10:49 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46907C061A0C for ; Sat, 9 May 2020 12:10:49 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id d184so2705492pfd.4 for ; Sat, 09 May 2020 12:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wf1n+hj5e8dyRivUQoz1C3c50QpmiVcBTEYF2ohJ06I=; b=ic2jDBAUdykvb8NzpOOfuQtQCAJskZi9+smoiPzH0xhkiX4pmSJiinej0vTVKH/221 gnrKMP7IOys7u092mkVJTRxQoojh82vCi5NVTTM9PF5p0zLJ9waRrFkClTf7fi/2WpPA uBgj5Ja5hpJz90iREzYY3zV5EovyF5+UvyYYQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wf1n+hj5e8dyRivUQoz1C3c50QpmiVcBTEYF2ohJ06I=; b=QRZtMU1IIpdC8ZFK6Fa9wzM+LOn3x9UJthfgqwESJWhSeBt6l1FEHvU2rfswVwXkd+ v2/y4zLFkxkOOHzxK3PV4Y7vE96b1ae5ds1qdVffBcHJ9IRmLrr04Vc5onxqiTs7iiY8 wDVR9pn6MKtUzJL8NbBOyRrpp+dK4I3sg0P9KBbJZ+gA4pT0oHcGwcggba9zOgaZs5F8 cE7ICOvzSXTKZjIAVV3S8XpDMaCoPbZbni5aABB3+SA9ZRvbFvdjgO/+KSplB/pK1y3p 1oo1aGl/YHCxn6wGNMKJo3n2ANnrTTT6XzZYU2rXmg5oo5rZJncfQw0p+b0VGdDYd7wL NVdA== X-Gm-Message-State: AGi0PuZ9+sQlpj+sCVa+2jade5KRBXU/r3RarTT3uHOo8EPia+aPA3YA 2+QSDJtHGdOkZWs5EJAUusFX0w== X-Google-Smtp-Source: APiQypIUCMS5XnSujPmoONFpTKJIcwb1UPhXWiVcur5+r5JlPaWLbFnndT7Bb71vHTwjtrn39ZObjQ== X-Received: by 2002:a63:7b42:: with SMTP id k2mr7065532pgn.299.1589051448671; Sat, 09 May 2020 12:10:48 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x7sm5289404pfj.122.2020.05.09.12.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 May 2020 12:10:47 -0700 (PDT) Date: Sat, 9 May 2020 12:10:46 -0700 From: Kees Cook To: WeiXiong Liao Cc: Anton Vorontsov , Colin Cross , Tony Luck , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , linux-doc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 00/12] pstore: mtd: support crash log to block and mtd device Message-ID: <202005091209.406DB4C@keescook> References: <20200508064004.57898-1-keescook@chromium.org> <202005080020.41C33738@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 09, 2020 at 06:32:28PM +0800, WeiXiong Liao wrote: > The following diff is to fix "rmmod" bug. > > @@ -1273,8 +1273,8 @@ static void psz_free_zones(struct pstore_zone > ***pszones, unsigned int *cnt) > return; > > while (*cnt > 0) { > - psz_free_zone(&zones[*cnt]); > (*cnt)--; > + psz_free_zone(&zones[*cnt]); > } > kfree(zones); > *pszones = NULL; Ah-ha! Thanks; I'd almost found that. I got confused because I wasn't see NULL free()s, and I finally noticed that the zones had left over ERR_PTRs: if (IS_ERR(cxt->fpszs)) { err = PTR_ERR(cxt->fpszs); + cxt->fpszs = NULL; goto free_out; } I'll fix those and your v5 and my lastest tree merged. -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53EBDC28CBC for ; Sat, 9 May 2020 19:11:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2E023208E4 for ; Sat, 9 May 2020 19:11:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UeXQtwb1"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ic2jDBAU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E023208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M+TtW/ASojkZzi4sWgkjOkzK4v9K9zsQ9K7c7fiB95M=; b=UeXQtwb1zd9/0L B2THpwNGWqI0HBByZF89hdl5Q861cRoVpSWL0Hm0rXPj2YFiyMzESE2K/WffO8E5XXNFjP0EkTubi vOaU+pQZqGgoBvpML8lUdWjp7cym0sZwLn3ec7rQlybbHEbc8ilQUSYeRUcATDXcCHc9iktNVSjVZ 2VfpN/SGR9e0dm2+nDCVLkVyOycP3v0zME+LQx6r7THVwqeFa74BFwOo0lkUMIgSvsNnBqEFMz/RE 9LWPdu/riZERBuIKO8kwFtj24Ai5GgbwFVVdZLKKB8BMXNgaS+WPza5bxKpl4li7Fut7oZ/Vey/oG YV+kB0VMWmwL1m5jm3fQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jXUs9-0001Fc-HP; Sat, 09 May 2020 19:10:53 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jXUs5-0001FD-CQ for linux-mtd@lists.infradead.org; Sat, 09 May 2020 19:10:50 +0000 Received: by mail-pf1-x444.google.com with SMTP id 18so2698870pfv.8 for ; Sat, 09 May 2020 12:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wf1n+hj5e8dyRivUQoz1C3c50QpmiVcBTEYF2ohJ06I=; b=ic2jDBAUdykvb8NzpOOfuQtQCAJskZi9+smoiPzH0xhkiX4pmSJiinej0vTVKH/221 gnrKMP7IOys7u092mkVJTRxQoojh82vCi5NVTTM9PF5p0zLJ9waRrFkClTf7fi/2WpPA uBgj5Ja5hpJz90iREzYY3zV5EovyF5+UvyYYQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wf1n+hj5e8dyRivUQoz1C3c50QpmiVcBTEYF2ohJ06I=; b=oWDQORP3Sdq3M78xgMXBPRN4fPg6raqavitdEB/sEo7N+CtIVyssubori7nrcJqg7U ImqV+so0C0V2U5dalINMH/flKANd5DGEi04GYWveWbGBTvefz2IHHxeC68xZPqV4wGjY nKE8LXlTm5WbXMWujaFObNTEumNhCHrsRVTjn4FFKs44jT6G51PFR4aDvURgPLBxYwih 9vDYLhKRux8UueH11b9ncq1x6LPRMTV+30SNeIa85xUICnovabj8o5FGhZZCPCxzX/GR gv61h4qk3wh3MD97aZtcsMQoU3ZyveNRaiqYyEOMqiF5v8qANA/s7RX5m3gaelncf7JO wVyw== X-Gm-Message-State: AGi0PubROWs4gPhgupTbe2+zLXdQxrxbznrwlwjKhuxFGdJ9Qod+FJbL gX8J/jncRx+KyZQz6aWjUxWHUcPZTVc= X-Google-Smtp-Source: APiQypIUCMS5XnSujPmoONFpTKJIcwb1UPhXWiVcur5+r5JlPaWLbFnndT7Bb71vHTwjtrn39ZObjQ== X-Received: by 2002:a63:7b42:: with SMTP id k2mr7065532pgn.299.1589051448671; Sat, 09 May 2020 12:10:48 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x7sm5289404pfj.122.2020.05.09.12.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 May 2020 12:10:47 -0700 (PDT) Date: Sat, 9 May 2020 12:10:46 -0700 From: Kees Cook To: WeiXiong Liao Subject: Re: [PATCH v4 00/12] pstore: mtd: support crash log to block and mtd device Message-ID: <202005091209.406DB4C@keescook> References: <20200508064004.57898-1-keescook@chromium.org> <202005080020.41C33738@keescook> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200509_121049_445591_1A07044E X-CRM114-Status: UNSURE ( 9.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Petr Mladek , Tony Luck , linux-doc@vger.kernel.org, Anton Vorontsov , linux-kernel@vger.kernel.org, Steven Rostedt , Sergey Senozhatsky , linux-mtd@lists.infradead.org, Colin Cross Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Sat, May 09, 2020 at 06:32:28PM +0800, WeiXiong Liao wrote: > The following diff is to fix "rmmod" bug. > > @@ -1273,8 +1273,8 @@ static void psz_free_zones(struct pstore_zone > ***pszones, unsigned int *cnt) > return; > > while (*cnt > 0) { > - psz_free_zone(&zones[*cnt]); > (*cnt)--; > + psz_free_zone(&zones[*cnt]); > } > kfree(zones); > *pszones = NULL; Ah-ha! Thanks; I'd almost found that. I got confused because I wasn't see NULL free()s, and I finally noticed that the zones had left over ERR_PTRs: if (IS_ERR(cxt->fpszs)) { err = PTR_ERR(cxt->fpszs); + cxt->fpszs = NULL; goto free_out; } I'll fix those and your v5 and my lastest tree merged. -- Kees Cook ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/