From patchwork Thu Mar 8 23:49:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10269443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B281A6016D for ; Thu, 8 Mar 2018 23:49:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1BB9299CE for ; Thu, 8 Mar 2018 23:49:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9598329B17; Thu, 8 Mar 2018 23:49:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 04041299CE for ; Thu, 8 Mar 2018 23:49:46 +0000 (UTC) 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:Date:MIME-Version:References: In-Reply-To:Subject:To:From:Message-ID:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=e2IWYlYSSpTRarRrG2MO52LDctTmJPVmN9xkgI9+mAw=; b=ePYH4hk2AsLSkuXaQ5RNGktHQN SzYq1FWm1rdmk2YZ7Qyu8FGEf3K2EGm2zdveakHEE8flphtMt8n1OSxphQG6Ue61o+YOG6p88K9Ji 72hxwuIxTOQFrmiDE4RZ9zs6JN7iPauy1eFQLVfH5oJlEfkOkE4aun+qAfL97Axphv1KzLbcmWGcy efjvtN4N2ZRVQOchQqorWZiSCJeM7+BKIRTzVo5tIPvIJAA9qDgptgWi7KYmuk9numGwT5n3i/CRy quVQM5TDwZIopwGDZt2jWSYUk//tu/Rsb9sBGb1EBq2FM+slof8SVDRv34YhZIEuilnSXjagT+f7G EvE5wapg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eu5I2-0000Pf-5b; Thu, 08 Mar 2018 23:49:38 +0000 Received: from relmlor4.renesas.com ([210.160.252.174] helo=relmlie3.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eu5Hw-0000NI-R3 for linux-arm-kernel@lists.infradead.org; Thu, 08 Mar 2018 23:49:35 +0000 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 09 Mar 2018 08:49:20 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 554854F433; Fri, 9 Mar 2018 08:49:20 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.47,443,1515423600"; d="scan'208";a="274621311" Received: from mail-ty1jpn01lp0175.outbound.protection.outlook.com (HELO JPN01-TY1-obe.outbound.protection.outlook.com) ([23.103.139.175]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 09 Mar 2018 08:49:20 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=s4H5iEmGDh7d8GcsXJQTin7/hQ48p0SLqXOigQAdAfA=; b=Rp5Kl7oTr3U+1nuPg32YMMidzrLF0+dZPLVXY7t7mEhhoVYSd4dYLc9I+HSVW6v0JVT+uDHQpgKkllnvDu+5nBxEBKjY0Vpvt1hBLcD6Wxy/c+Oey4b1/uGWxb3VtUygOQ4Eh7nrT+iQy8p5KxvYdwbBJxEnU+G7hcq8KRm6BDU= Received: from morimoto-PC.renesas.com (211.11.155.138) by TYAPR01MB2077.jpnprd01.prod.outlook.com (2603:1096:404:7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Thu, 8 Mar 2018 23:49:18 +0000 Message-ID: <87h8pq166i.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown Subject: Re: [BUG] Kernel crash on Allwinner H3 due to sound core changes In-Reply-To: <20180308111348.GB6019@sirena.org.uk> References: <2424862.oPtAVTfrB9@jernej-laptop> <20180302124050.GF6255@sirena.org.uk> <26212674.B0xcQEiVyd@jernej-laptop> <1832733.mujlD9skaR@jernej-laptop> <87efkvtldx.wl%kuninori.morimoto.gx@renesas.com> <20180308111348.GB6019@sirena.org.uk> User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 8 Mar 2018 23:49:18 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: KAXPR01CA0037.jpnprd01.prod.outlook.com (2603:1096:402:1a::23) To TYAPR01MB2077.jpnprd01.prod.outlook.com (2603:1096:404:7::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: aa4ba014-d1a8-4c10-baeb-08d5854f3565 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB2077; X-Microsoft-Exchange-Diagnostics: 1; TYAPR01MB2077; 3:1KvE/RgGEjYvKzbhAQHgo6fBWXNZw6gdZc0rDpJvndqWbhT2xpbu/OWiveqOJ7hz6lrOWe8te2GUqyls6nRPx4WQM6PJ+nZVIPggs3J/oTyy2755g7nc9s4gaACy2M0UIlaoZC3Ym4t8+gR5atXiIeslphZZ9mmGS1K/+ToJw8Og3v3GZWgBtIBKztxjuhNkjfdSLwFN3iUH8X+15DcE3gwiGsoqkjPVe6Mp3eq9hGc9b2+hS5P35/oZlEJ3TgJr; 25:xbpuARi/5brL+xmUsqDQLc2GX0CJBRwU72R070E1y29aOJnWw6miR9lfUv4LthbRom5IBZHW/2I1J+bEhzhdiSzBDGheBPsetq6uBd9vAvLENnsBeO9sMa9nI0eAmwxQizWF5dhCb5sfIXUlZLLCXOa4MXOXRlA++9O7qQOUcsiIRzrBPINgH+ElaqDeHdmxqkzAfnr2rqfsOCsLSCvDXsUgaa+YDup+5nHyeuYmrrJMjIi7lO+sZMq78PL8gDNjLyvXScH54bor6tvvT2RPKqDMfwNdhhua05PPM72zjxb9BZgTgekD9GttdRNYERgzHyzAGEi+RK5FoFJPRvzA/w==; 31:I8TDp32lxOY6kvGz0cynOfxczMD1PdpDm8Ju6iZtl00QzOMFUNR3X/YOYGzqWq4Fh8IGVlx8cxwdKhLc1mdIVhK5U67nMNsG5wm3SgKf7QZuvvMtWPRoqqwL0G9I/4uyHVEEFC9wjj5GteQmxRXkQz3UMZql2o6JDFLN0NDsRNYhUHCGfd4MgsfCALUhp3kk1FQnm41ZWvqM/lKKDG1YtpqB4v7cQS31CbqhQeuObcQ= X-MS-TrafficTypeDiagnostic: TYAPR01MB2077: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; X-Microsoft-Exchange-Diagnostics: 1; TYAPR01MB2077; 20:kdl94CRYwFz/Y+eZ6hxPMkEcKJvGgwMSkMHsssUyw7sxxGzo9r4ySiC667Ot9jgCJdkK0lYCNSVbvWFFi5pUUrwtQJHPyVZdWJXWBhae8YtupLNB4uxuYA/9RAU/x5ZpgPWc9hDjj27Oo14E89t93K0s02kyjkpkDn+V+ovLND1Ep5EpjDI5w1LgCWy4Bi+SM6sB7JIRZO6elTEOvGBpeIYOIlTWxWO9GQkNUtw+QUSufcuhTAusQsP40Y7XGRjfgUIaufSxOOo9K3/C/iPw2rV9oxjLyvsHOzxlNu6BAuIwLSpXaoWaGRMVOovoyq321HEXSR/uQd6mCEvCSAtzJU7ymci+3FkeWuEu38QTiSfTlv6olVHi/R2pjh826m9yYgTydgE9miv1Me0HeUvEGkL8kJwPyK0GMI1azHkBrqfjW1euIJkSjP2EiEOpYH+GwnDCqk1ZPojsf1e5YnLZuBVWBL8wqGnusSQQciRl1P3DYBtZm80KH1oHk8x6D3BE; 4:HFSp3dEGvrXkzFJ05tigLlPXfCIW0PK/Ey7lOcZhs04r9oVMuNpm6xKJKjn3VlE092RzfjH1Oy/Ru2s12YeGlzxFsyDpQJ0xH3pLxYBUzIQe0E+MFALH3A4K6aaShBZMv1BEq+tREKjoQMnNm9q2qu8EQf1aHucJby4Nyf72lpWHiON4ppaXMTYQcUZvqNnieq6Wdg70GvwJ6Jyknbk5CTyrx+/LrfaVSqx+YtQghjUABrJQQuzpiJwMYEmqvBQtdd0oMc1WonqqBJ0LIgyc0A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040519)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(3002001)(10201501046)(6055026)(6041307)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:TYAPR01MB2077; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB2077; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(346002)(376002)(39860400002)(396003)(39380400002)(199004)(189003)(2906002)(86362001)(305945005)(4326008)(575784001)(69596002)(6916009)(2950100002)(478600001)(7736002)(5660300001)(50466002)(229853002)(47776003)(106356001)(6116002)(3846002)(66066001)(23726003)(386003)(105586002)(316002)(81156014)(81166006)(8676002)(25786009)(76176011)(93886005)(26005)(68736007)(53416004)(16526019)(53936002)(186003)(7696005)(52116002)(6486002)(58126008)(16586007)(6246003)(8936002)(36756003)(97736004)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB2077; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; TYAPR01MB2077; 23:noYROnvJz0JdOK2pJyo/lJ/Qeplbg1jiGGgjF0Fj1?= =?us-ascii?Q?AepJy3jwaU6bhMjOCrpuS7movLlEFu+ujZyEdIfXp6KlnT9AchSDrwlAUt1d?= =?us-ascii?Q?5/NCoUu/fH+LzkqNawXNGdtdB52DItVvEkdxErflnItJu5OHpchIDBEvcqIV?= =?us-ascii?Q?mmz227ak91nipqrMcFDaEcJJ5LateAgP5GtDkWPecI7FdMKWSaS6LiIkbjYk?= =?us-ascii?Q?euxZ1ZaCg47gPKHKCMFbfCXC/jd3uvRdAyTZYHlgf1UY8pNVU3RyglBAcwNu?= =?us-ascii?Q?LFPaeRKAoT/VoQX1jgUeE2MPpM0cd1Uoc4Uw0FuPwglXnAYNwOXbJfPbtE1P?= =?us-ascii?Q?nZMhgfWcNA7rjBX0435fbpluVDAr6EQjgJaSzvpnwZSlr5uupK69EiTWBApI?= =?us-ascii?Q?+iIZ92zi6qyj+SeCJfaWpXr9cTb1uGn/0l/i4z9LvqoQcWctBqFOBE9FfeWT?= =?us-ascii?Q?W/v+AgODIBIcb5nbVJAnZPKcCHrcU733fKWYG6C9kBNjSpyUiNXeHa5uUznN?= =?us-ascii?Q?8S5fY5wVKgTew5l8rAVCowDr761As4c3kK1ETmAGLJ7mD8Tven/ImDs1ACFQ?= =?us-ascii?Q?1j20ByzgsDsM6aIZgUSLUJlOacvJ5QThUP38QiB0NReyECHyJYUINkjstIma?= =?us-ascii?Q?j788N++kOOjlGMcLKW1pBHhIDeG2Jwi4gH0vcpxa35jRDxNutZXH5VqJ3LFf?= =?us-ascii?Q?zJ19IpmGe+mkvUoKiQmb2Q6EcVM2XjQNvrMdqanKeTsleTles2rs578wT/oS?= =?us-ascii?Q?DpGuJn98vVbHK10zDRRHWHBKmlOV+gZCUFAnnDPEcFmBYo1ce50BnaIrPaOj?= =?us-ascii?Q?JtmPaqENo+A1gSyn3fImgKerIzQTs4f383DjRt8gSAOrkOl290ZAseejEvJ+?= =?us-ascii?Q?zzLpPqWV4m6zwjsWFNwYeY3MdC+m4WykOPbFuji3vrmb8GZQ4XYpwAIPsjHG?= =?us-ascii?Q?gkaWf2oStjj0syeER6z9Oa3pNkGydu69ODI2zY4gYqKGkhnp1d1j/yFQGzRg?= =?us-ascii?Q?vRiRp1HRFJM/Hzo6uhomsp9HTC+5G1fiYdbXVjAzEhwhZVEg3zAPkrLCF9jW?= =?us-ascii?Q?oN5KNL3tWP+bm2nYmqeRhAVSdWTmHhuYH9lrTnovM1k9Z7rTrFkhI16A9dn2?= =?us-ascii?Q?V1vOM62Cr/3EERJaTx8hMrCdkYzAGcr99Mkuv9vy5U4SGQQZwxwaHAThxb84?= =?us-ascii?Q?wDGttfQxZaSEud8h7Oy4wbupeDxfZmEojMA?= X-Microsoft-Antispam-Message-Info: xJEYecxIAlPKGLrf0o3JAyKJ77z+7kG3oMabrkO0IBtw8gZTU1yBDA44rmJWbuCCddXhjaF0OpSAXBAi6xJyU4ALUziUvIxKSMgvrEqpvTtlbEpl8LXcJFVf/9S/U/p7GFnyFo1Qf7x34589qgdTNgVbRIOhfPXcGmZTKq0R/pB9yhHy/ir5fxzZyIdlnm7K X-Microsoft-Exchange-Diagnostics: 1; TYAPR01MB2077; 6:dBBgRxwbzNLP3JypnyvWY5DCxW0k9anFXKwRqVroREQ8tEpPD1nFu9EKQe3ZMT+qxG/cNDJwv+QW3ClYKlVPVXl0iimehqmkWb+oHdbQT8Lx24sufmq2U7jW27LA6MWWhJpM2loCr9Wyz12Jqhd8v5OS4QsbFNLEQJOlCco6LaBeF33nlOx0V068DwoUlK1wPfgDuJ1Pe0oefvNTJEib37KHYGeuOvGb5FMP5d/W6h7ejLgzTu1B/dnq31/9VgykQmEzla8jvW7M29gbicvPL5FX1GZX1tnwo5KXLf03XZ+hX7agS7b9/ontraPSfqTwykH4SNUE1+2/Hh2tVBQ3XxnabslzleciUOmNs8n0/RQ=; 5:UG+7NXuEFeOc1tm5AM1lvzwMiAiSE1issOEjmflztymjfFyUZr2z92I6+7AT6qOG7N9uOacBnfj4s0gJVSYOrpKEsEnxM8Y9QOv7EbpQ3SDGZrrduZ2Z5ZBG0ee9MqV+F3fHWm0jS28SpaWWYXKh6T5odP5Q4OcJL2Ruj/Zv3sw=; 24:/G97xVq3aiRkQuXMBnEgWa3dRLTwfC9qOtJnq2EfLKmszJOhVoe1OXPf5oJkI4fkEBmwoiK3sV1PTySgNRCSaoNcVay/FelGh32FhK1eonA=; 7:Z7UDU0KOC/5cqiwthJqVHXwO3QrngXvgKGU1JrVpJYYNKLqfDxHJ4NElAYW8R3/zA7Oj4zRqH64LDD/mZTpT8RBOIj19m+EY7yae69GMUugI76P/ryM8RNDiTvy3IJkcxK61wEtfaHCZpiPaZ0o9vRqc6DMBKJeFg1i5+p2F6kAKnr1OgyaUSbXMIAxQdYGpP/+B+yYA3EP03160HJdSqfuS+h1IqvFt9nBHFFu4gDzSSr63ikN70GWE9rN71MEi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; TYAPR01MB2077; 20:uq/gicyXvq30icPf8CaQVVLadO7XrCXic1e3971OSsxTeRhm30TtUuFly4iMRBn8yQHd0RdY6la2I62Vr3mWWvXoQOiIWOUbxrmyge18Tzk/xPF9+qz8BcharjQVps+BBvPfH2DHcqudeNyWeD3Y1qQu1G2ycrxRCnf5FN2M6sM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 23:49:18.6469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa4ba014-d1a8-4c10-baeb-08d5854f3565 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB2077 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180308_154933_263816_D3BAFACE X-CRM114-Status: GOOD ( 19.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, Jernej =?ISO-8859-2?Q?=A9krabec?= , linux-kernel@vger.kernel.org, wens@csie.org, maxime.ripard@free-electrons.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Mark,Jernej > > Ahh.. indeed. Good catch ! > > How about to add such flag ? > > This is just idea. No tested, No compiled, but can help you ? > > I think this makes sense as a patch. We might want to disallow > allocating components as part of a bigger struct so everything is more > consistent but that's a bigger thing. (snip) > I tested this patch and there is no crash anymore. If you will send it as a > fix, you can add: > > Reported-by: Jernej Skrabec > Tested-by: Jernej Skrabec previous my patch used new flag (= .alloced_component), but I think it is not good idea. And I noticed that snd_soc_add_component() is also calling kfree(component) (= has same bug). So how about below one ? I want to post it instead of previous. # I will go to ELC next week, thus posting patch will be # 2weeks later ------------ ------------ diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c0edac8..4a8de23 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3476,7 +3476,6 @@ int snd_soc_add_component(struct device *dev, err_cleanup: snd_soc_component_cleanup(component); err_free: - kfree(component); return ret; } EXPORT_SYMBOL_GPL(snd_soc_add_component); @@ -3488,7 +3487,7 @@ int snd_soc_register_component(struct device *dev, { struct snd_soc_component *component; - component = kzalloc(sizeof(*component), GFP_KERNEL); + component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL); if (!component) return -ENOMEM; @@ -3523,7 +3522,6 @@ static int __snd_soc_unregister_component(struct device *dev) if (found) { snd_soc_component_cleanup(component); - kfree(component); } return found;