Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1157007imm; Wed, 1 Aug 2018 11:07:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdMHH54K0SeOes2cYAVyyc+y+UbOu9cJ+eyzrT44nyk/MCr6SEUM3lzOMlktCy8KYWTZufX X-Received: by 2002:a63:1a20:: with SMTP id a32-v6mr25528584pga.446.1533146846843; Wed, 01 Aug 2018 11:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146846; cv=none; d=google.com; s=arc-20160816; b=zuvaGoAeo9JAAhrRaHdvTCsjDzwxB8brJymnH4U0Dlo1SRw7U4TJrIMhilkOOqEFwJ kBs4CuRmHVAjaClKhKxIZPw8hr7hssHcpv11TmHOlrn1JlBhtJtAtaL/xREsy+6QdHNs fwGEQw7Vkbt/kHR5uLRARL804B/9zgFSgrbSh2/nNcHlwyqEMUUCReyPQHCiP16SfvGR olhJBvhycIc31ACknvcM/tpqjn8kJMEIkhQWVKMOR3UIJc3BaNTYPCz5sNPwLdekEBwa uZCu3SC0r/ew7VaE6MWemUF7xiKQ0kmVNK2hzCJzS2p+nG0EVDhB+FAKBBwuTumefaUT /hGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=D2PNyk9aFET4lZhzIeVHBesjDnyoMHIz5IzyOBjkvVg=; b=q05k2nAOoCby9uwrxFPgJgsZ5BFR9VWbT7qMWpw58E43aZvJk8zHwSrJewu6pK3Dhz Z1TKFnDp1qu3EIAAaCSuLnM7s2fw/+9DNVzUTrcV1ABECuZ4m9NAGQef3iwz0SG7pEpI tugv+bhaOQ/Vr1VBgSBrnTpCVvSUYWiCwfRY4Jc9HrXNVivdWFldaTz4P/mfySkxxHxn l0Xu7cYFjPVsTv0MnTOaQq8UuYvIVYUJNZWK8gxwazum2dnOmRmTrkKghEQN6zA4kTT5 qYaPDNgph9lSNY9L40S9O5Ma7nnylipqaXNxaRfsKwzxwmHCnvEhzeltBV5HrnZUSIfl JJUQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12-v6si14528213pgv.296.2018.08.01.11.07.11; Wed, 01 Aug 2018 11:07:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732770AbeHATxI (ORCPT + 99 others); Wed, 1 Aug 2018 15:53:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50150 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405816AbeHATIh (ORCPT ); Wed, 1 Aug 2018 15:08:37 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 571A01392; Wed, 1 Aug 2018 17:15:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhouyang Jia , Takashi Iwai , Sasha Levin Subject: [PATCH 4.14 024/246] ALSA: emu10k1: add error handling for snd_ctl_add Date: Wed, 1 Aug 2018 18:48:54 +0200 Message-Id: <20180801165012.852292715@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhouyang Jia [ Upstream commit 6d531e7b972cb62ded011c2dfcc2d9f72ea6c421 ] When snd_ctl_add fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling snd_ctl_add. Signed-off-by: Zhouyang Jia Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- sound/pci/emu10k1/emupcm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -1850,7 +1850,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10 if (!kctl) return -ENOMEM; kctl->id.device = device; - snd_ctl_add(emu->card, kctl); + err = snd_ctl_add(emu->card, kctl); + if (err < 0) + return err; snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024);