From patchwork Tue Feb 19 12:04:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10819771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF6E713B5 for ; Tue, 19 Feb 2019 12:04:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 992902BB77 for ; Tue, 19 Feb 2019 12:04:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A1972BB9F; Tue, 19 Feb 2019 12:04:55 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBCCA2BB77 for ; Tue, 19 Feb 2019 12:04:54 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7F902265532; Tue, 19 Feb 2019 13:04:53 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B5DBE265533; Tue, 19 Feb 2019 13:04:50 +0100 (CET) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by alsa0.perex.cz (Postfix) with ESMTP id 8D18D265523 for ; Tue, 19 Feb 2019 13:04:47 +0100 (CET) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1JC4IUN043453; Tue, 19 Feb 2019 12:04:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=6aeJ2p69s5f73fPTkHpC8QhVt/WZ0/UCBDFDh0IQ104=; b=iSYIac1i9g1Fel4rzYkSqhNau+UxhgruYlQiqFqhZd6eBa5VF9Wm7G+OOlCi8OpKyPhb tsKC9MPjuYEfFGUTq62BhUta+9mRZdWs2Cd+W5sg6okQ+I+vvgLd8wNvEjdby4iFYc3H 8m3oREbRrBSgU9MKn8JRe+u4o24tXYh59Zc712d8NNphihfBgJxta1z67AKY3ls8De7w Zo9RS/BfEc9D3LQ5GxXAO9fJZENiFeTH1tvAc/1Gf9P2zaIGFYXYdRdzC9AwmfwM1Ids dVdkhCng+F3WChR3Iee1miJkQRnMeQXDL9c2d62FJ0aGlOeAHBWDiNZS4C5uTM5L5iR9 PA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2qpb5ramp0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Feb 2019 12:04:45 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x1JC4d65014078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Feb 2019 12:04:39 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x1JC4bRE022544; Tue, 19 Feb 2019 12:04:37 GMT Received: from kadam (/10.175.25.58) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Feb 2019 04:04:36 -0800 Date: Tue, 19 Feb 2019 15:04:27 +0300 From: Dan Carpenter To: Liam Girdwood , Pierre-Louis Bossart Message-ID: <20190219120427.GA26719@kadam> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9171 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902190090 Cc: alsa-devel@alsa-project.org, Mark Brown , kernel-janitors@vger.kernel.org, Takashi Iwai Subject: [alsa-devel] [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP We should free "w" on the error path. Fixes: 199ed3e81c49 ("ASoC: dapm: fix use-after-free issue with dailink sname") Signed-off-by: Dan Carpenter Reviewed-by: Pierre-Louis Bossart --- sound/soc/soc-dapm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index dea6fc2353e4..1ec06ef6d161 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -332,8 +332,10 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget( */ if (_widget->sname) { w->sname = kstrdup_const(_widget->sname, GFP_KERNEL); - if (!w->sname) + if (!w->sname) { + kfree(w); return NULL; + } } return w; }