Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3531234ybi; Tue, 18 Jun 2019 02:16:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxG6DQzHf8vy1lMOr+OTiVOOUhK6PCVtYO4AWCmkaD0hvVX9LIbbuKYX2a1jZ4VzfLOG8tH X-Received: by 2002:a17:902:61:: with SMTP id 88mr34005949pla.50.1560849388681; Tue, 18 Jun 2019 02:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560849388; cv=none; d=google.com; s=arc-20160816; b=T65IPGOOB9Rtj24p9BN7JVzCHYZHhEFunRFzhCRYY+MbZSLdw0cNLVw8JNNDV5/qMN +U2irqj8TXa3tzPxOylop6LDPb7ufyNsrbiATwmrX751tOhProvsb60CnLkvCytcswaJ 1kgGhPL9IIJlbf0ULggiqwgrlRzaouVbv3paKNmgx0El5LVgIoLU1Rld5nSKQmGp87RH RLEQBPyVm/nxrvhgJQQmhdaqXPf8vALwuF4AmZo5cAR32TmLq1vvI7A+kLB1L58oR1Nw PKMFHaBtYDBrD/GRk3JvUgGWkzrarZsMATBqRUhKjOYETJP2A8RSWlrcoOiD/qApdhXC gTqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DhF7bS6gmqkQOBC2xQ0HmjaDMn2HIdRFZhJUKDr3SYY=; b=kDvOISWbpTC+fVg/9XcEX7Q8BSK5cCYSx0VDbNFG1OMt91Dnrqy6S/LWRB5oap8WEj Mt/YOZtkFnuUHQPjA3/sObDjGglk64lGJ7ABJ7MmD5dR1nb2QFRR5VlfYVpC8n4EblvY PNw8NXoyum6QTYgFLBXMs09jTsJwEtLvJM0ESMEq64SJ/2+O9aKWJpHoW7P0rLDFZUcE P+SXMQuKQBj/U37MD9qspQwSfTYqHLnwA/Sf3H5UJPWeu9P4P0jlk27yBa9K9ttKQcZF VmAaGjTB7WQ48R6DB890uGRp2zXgLXAaOD1w/j0XU5wbrLmRxEOXQVstkPoeVZXLnd7a 4OhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1AE0dKeX; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k73si1887038pje.10.2019.06.18.02.16.09; Tue, 18 Jun 2019 02:16:28 -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=1AE0dKeX; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729369AbfFRJOG (ORCPT + 99 others); Tue, 18 Jun 2019 05:14:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:49600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbfFRJOF (ORCPT ); Tue, 18 Jun 2019 05:14:05 -0400 Received: from dragon (li1322-146.members.linode.com [45.79.223.146]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5BB13206BA; Tue, 18 Jun 2019 09:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560849244; bh=G5n7tQEA4D7IaVaj+n+intnIJiU7vvwx1xThRaNy7Nc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1AE0dKeXOphrd0NEoeC0kvijNE5Z3yzzZaSZ+0GwZF/SIAzx9uT2NX9XnsXG3ogcj fzvhWN9nY3ncNjYjwlBe42xt7Ro2jBIaXnuq2wX6uSretwiO9qwiZvVSRD/RhgOnNT B0GLmfhS0LDLFiXbe1ARbwhGxQnwLiPB/9vzspXw= Date: Tue, 18 Jun 2019 17:13:10 +0800 From: Shawn Guo To: Anson.Huang@nxp.com Cc: s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, leonard.crestez@nxp.com, viresh.kumar@linaro.org, abel.vesa@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linux-imx@nxp.com Subject: Re: [PATCH V2 1/2] soc: imx8: Fix potential kernel dump in error path Message-ID: <20190618091309.GL29881@dragon> References: <20190614080748.32997-1-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190614080748.32997-1-Anson.Huang@nxp.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 14, 2019 at 04:07:47PM +0800, Anson.Huang@nxp.com wrote: > From: Anson Huang > > When SoC's revision value is 0, SoC driver will print out > "unknown" in sysfs's revision node, this "unknown" is a > static string which can NOT be freed, this will caused below > kernel dump in later error path which calls kfree: > > kernel BUG at mm/slub.c:3942! > Internal error: Oops - BUG: 0 [#1] PREEMPT SMP > Modules linked in: > CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.2.0-rc4-next-20190611-00023-g705146c-dirty #2197 > Hardware name: NXP i.MX8MQ EVK (DT) > pstate: 60000005 (nZCv daif -PAN -UAO) > pc : kfree+0x170/0x1b0 > lr : imx8_soc_init+0xc0/0xe4 > sp : ffff00001003bd10 > x29: ffff00001003bd10 x28: ffff00001121e0a0 > x27: ffff000011482000 x26: ffff00001117068c > x25: ffff00001121e100 x24: ffff000011482000 > x23: ffff000010fe2b58 x22: ffff0000111b9ab0 > x21: ffff8000bd9dfba0 x20: ffff0000111b9b70 > x19: ffff7e000043f880 x18: 0000000000001000 > x17: ffff000010d05fa0 x16: ffff0000122e0000 > x15: 0140000000000000 x14: 0000000030360000 > x13: ffff8000b94b5bb0 x12: 0000000000000038 > x11: ffffffffffffffff x10: ffffffffffffffff > x9 : 0000000000000003 x8 : ffff8000b9488147 > x7 : ffff00001003bc00 x6 : 0000000000000000 > x5 : 0000000000000003 x4 : 0000000000000003 > x3 : 0000000000000003 x2 : b8793acd604edf00 > x1 : ffff7e000043f880 x0 : ffff7e000043f888 > Call trace: > kfree+0x170/0x1b0 > imx8_soc_init+0xc0/0xe4 > do_one_initcall+0x58/0x1b8 > kernel_init_freeable+0x1cc/0x288 > kernel_init+0x10/0x100 > ret_from_fork+0x10/0x18 > > This patch fixes this potential kernel dump when a chip's > revision is "unknown", it is done by checking whether the > revision space can be freed. > > Fixes: a7e26f356ca1 ("soc: imx: Add generic i.MX8 SoC driver") > Signed-off-by: Anson Huang Applied, thanks.