Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp288607imu; Mon, 5 Nov 2018 00:30:04 -0800 (PST) X-Google-Smtp-Source: AJdET5faf1PGKIaobJeWs2rxK8zVjr002Ne8tTeb6UjNYi55dvm3YJCjmDHlXhKvibia/8n4erI2 X-Received: by 2002:a62:3782:: with SMTP id e124-v6mr20723191pfa.145.1541406604633; Mon, 05 Nov 2018 00:30:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541406604; cv=none; d=google.com; s=arc-20160816; b=vPHBNmNKidPO8NGr4X7QAjv0VKawFuAlybbcyxx8buPBd8BuTpVEQdR3ywnT5XLwhT ERplzPoM1SKF+6D1YdlQSdZL6bRfCuM3GAgGZthJW/YLffFXF0k6opWgOEv3WpyQH64P wSstyITg5+tATaimrLz7WaFq7EajAaBZnbTxvpfxdxx4O7QDsGoqIir6X2LOsuZOjAke blq8k7hxKgKGXxVjad/oDHt5TwLW55yc0aNSZqw17D9QubFB7rNiJS6EHyvsW7/54b54 eq4YNvHJpoyOupXNv9n5k2qvIQYdSXKp9fXDE0XRXsZzyAo5yTHMAI7isJJ5cJ5GjMdz YDXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:message-id:date:thread-index:thread-topic:subject :cc:to:from; bh=A6OWLbjeW/4tHk7M6gOZVL2OGDTevlqZYpu2P0XULJY=; b=Y3zhCYqe0xa4qDe1FqpSqaOX8GXoPv/rnt3u6ZZpVYXeu7mEgRoxgXBj08DYnZD/24 CsP/A/RMEXqWh6Cz6YdxGqUEm0QVCu1UNkECQ3tNpQbfoVX2ZTOhQQu5RhUCFpOKk43E OvwwAaYKZwlh+h5u+3fpEAD4sLL6ie961iU+CFQdq6E4NKJQyZ1+Qm/xfY1pbTrmd6/g fAX+P56/w3D81i27YCRPRKOn4saCBzagOXpbJG4kdgWwJX6n7BqEjl2tKRx3/3MarPLy yC3V223mEyNNfDmLh57GvhkQgMqn0dUTRmugmFVBgABwnQ1ar/kAjbjLfUec/92pe8F6 j2bg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si9425596pgn.551.2018.11.05.00.29.49; Mon, 05 Nov 2018 00:30:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727304AbeKERru convert rfc822-to-8bit (ORCPT + 99 others); Mon, 5 Nov 2018 12:47:50 -0500 Received: from mga05.intel.com ([192.55.52.43]:51137 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbeKERru (ORCPT ); Mon, 5 Nov 2018 12:47:50 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2018 00:29:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,467,1534834800"; d="scan'208";a="88626745" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga006.jf.intel.com with ESMTP; 05 Nov 2018 00:29:18 -0800 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 5 Nov 2018 00:29:17 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 5 Nov 2018 00:29:17 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.102]) with mapi id 14.03.0415.000; Mon, 5 Nov 2018 16:29:15 +0800 From: "He, Bo" To: "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" CC: "pierre-louis.bossart@linux.intel.com" , "liam.r.girdwood@linux.intel.com" , "perex@perex.cz" , "tiwai@suse.com" , "Singh, Guneshwor O" , "Periyasamy, SriramX" , "Kale, Sanyog R" , "Kesapragada, Pardha Saradhi" , "kuninori.morimoto.gx@renesas.com" , "guruprasadx.pawse@intel.com" , "Ughreja, Rakesh A" , "Prakash, Divya1" , "Diwakar, Praveen" , "Zhang, Yanmin" Subject: [PATCH] fix the kernel panic due to wrong use the dev memory API Thread-Topic: [PATCH] fix the kernel panic due to wrong use the dev memory API Thread-Index: AdR02etIVOQjufWdR9C3OioDFWN13w== Date: Mon, 5 Nov 2018 08:29:14 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjcxZDQwZjMtMTMzMi00ZTRhLWIwZDQtOTI1ZDBlYzE5ZWQxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMXh3ZEJGazdxVkFuQkU1UG45T0tIQ290c0F2NCt3R0FmYjY2Y1BEZ29LSXVtWkQwRkJjRUJnUlZ4amtNVUpodSJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org skl->dais is allocated with devm_kcalloc, can't free with the krealloc. Memory allocated with devm API is automatically freed on driver detach, Like all other devres resources. Refer to drivers/base/devres.c devm_kmalloc for more details. Signed-off-by: he, bo --- sound/soc/intel/skylake/skl-pcm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index 823e391..928d314 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -1438,7 +1438,8 @@ int skl_platform_register(struct device *dev) } if (!skl->use_tplg_pcm) { - dais = krealloc(skl->dais, sizeof(skl_fe_dai) + + devm_kfree(dev, skl->dais); + dais = devm_kcalloc(dev, skl->dais, sizeof(skl_fe_dai) + sizeof(skl_platform_dai), GFP_KERNEL); if (!dais) { ret = -ENOMEM; @@ -1472,7 +1473,5 @@ int skl_platform_unregister(struct device *dev) } } - kfree(skl->dais); - return 0; } -- 2.7.4