Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2663039pxj; Mon, 14 Jun 2021 04:20:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynnReCkz8Fthcamv9E6lJ2uMoEX9Uty1DixmYbowviXK+kghhlroXzKwrra5/2UMNtpaGv X-Received: by 2002:aa7:c594:: with SMTP id g20mr15961890edq.193.1623669659318; Mon, 14 Jun 2021 04:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669659; cv=none; d=google.com; s=arc-20160816; b=UgfX9Wutzm+gori1eWkl3wqdtVp5b0qiVej3cWcd0yitwZn0SVYeQzVTyeyoKV8G8F FZRGm4516np27MgS/Gy9IvYSt1vTnm+dhS8cWjj9gjk/u8OFsLlRklexQwniVJftOzLq knS3mVtcptkuxllmd6ASPWusQTid3txmISJWxBvIsF96giYIe+f0d1noGSR+a374FqE1 hgCR05vhSccPTxGIVtaM8Ylgg36IYZP97svIJd894+vJsNktCZfr4K3qywE6MQtQCSEM CpJvAc3K5n1bStdByZGyWOIEBmjt7YPOkBz89VYysP2ZP2uu0wcEGgjd+R+UwLdeD89m tT5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AdppOsX4ycb/sqQI/UThgbyGwaYM5Zv7kSqexcNdo2g=; b=nLhM2vDrvznZYiqYwy+YjQu/oOkSa+XrtKAERjawK9XU2O5Aq8JyyixKzQNCPWGf4Y UjJlDT/zk1iF9wagrY4eYM5+MESBGi8Gszl3qN+EhpQzrPD3P8fDPiFj3EBdXfkPZrpX iHadu4+0BzPjlKXgc6LuuaCSNchJmVKAQanMjp8MN0/hIt3c4k/n11D4nyC85F1stdyn RNk1kqZx+8IRP4us9f5CxcB3hnCBMkS13VjE+QLj3BRYbK6RWNjeFhFNneqNyf6DkeHN 9geyBYrlSAk+IYeziZEuSmM1adOERZBA5TifGqBcgA7ZQ/xBUdpSs4o6AdKopAOBi7U1 G84g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JHlW1QV+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si11266577ejo.252.2021.06.14.04.20.37; Mon, 14 Jun 2021 04:20:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JHlW1QV+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235720AbhFNLTR (ORCPT + 99 others); Mon, 14 Jun 2021 07:19:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:39116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235277AbhFNLHH (ORCPT ); Mon, 14 Jun 2021 07:07:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B560E6192C; Mon, 14 Jun 2021 10:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667540; bh=ymMvKZday3N97gXePnaHi/mKw804oVTZT7WMP/3G9TE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHlW1QV+fPk2bsRVDyfNpDzeDWkpZZ9gMvmfE7SQ2sctn8VCpeR6CI73sNqWcowCY s3hqHfHVfsS4FqByX/lPXurG0kaPcazqajnbJF/69DIpRs7fVLgE7bvPmLZcj2Y2bW Bw6nKVAhlxuNv3pRa2xGZpXch4sNLB22UQsnbA+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Hulk Robot , Kefeng Wang , Mark Brown Subject: [PATCH 5.10 109/131] ASoC: core: Fix Null-point-dereference in fmt_single_name() Date: Mon, 14 Jun 2021 12:27:50 +0200 Message-Id: <20210614102656.710908899@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kefeng Wang commit 41daf6ba594d55f201c50280ebcd430590441da1 upstream. Check the return value of devm_kstrdup() in case of Null-point-dereference. Fixes: 45dd9943fce0 ("ASoC: core: remove artificial component and DAI name constraint") Cc: Dmitry Baryshkov Reported-by: Hulk Robot Signed-off-by: Kefeng Wang Link: https://lore.kernel.org/r/20210524024941.159952-1-wangkefeng.wang@huawei.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/soc-core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2231,6 +2231,8 @@ static char *fmt_single_name(struct devi return NULL; name = devm_kstrdup(dev, devname, GFP_KERNEL); + if (!name) + return NULL; /* are we a "%s.%d" name (platform and SPI components) */ found = strstr(name, dev->driver->name);