From patchwork Mon Jul 12 06:11:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 472975 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2683493jao; Mon, 12 Jul 2021 00:24:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIhKV9p5ilwppKqesTYCODjE+Dr3rPxrpIIBjtCfyUs1dGyRlp3Ral4Gw3q0gTy1pkHfLo X-Received: by 2002:a05:6402:29a:: with SMTP id l26mr34101873edv.207.1626074654095; Mon, 12 Jul 2021 00:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626074654; cv=none; d=google.com; s=arc-20160816; b=J0GtmPIE99P9dvsJZOsVMytq2tAAJMHvF5DULzMtk00HJ5v0KEKWMMVecR5lqt0BNB KP3no3lxABghqG24GG/GTmDdEOC1AN0P1SI7FSENrJ7sSqqZJn+v1fUNMyGOTix6FpWc qvPqeqe69tIFWWZ5He/LjqPy3luFg8kI6Y6Bs9xAUeZteFPoKR8hBSmn3ICWRO2WRgmi gm+k9oGaWRIqqB8BdOtIoYxNFURViY7wvOQ4Pg/DTARnJSS7gGTxTrE2LnKthdeIDTJi +49QEzJomtnKv9HB4Pd4cfwV73GWtokgzpjCTQGKji+wugUSgNVU+o6kq5/WPtjLS3Zf f+Fw== 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=NM68p+feinJTEulBZtbK4RXRrPZM7HSUjuq3MSZt4bE=; b=p50luPyLSAS0AYGseUgFWKvloU3nPF0AbuLkKSCvDpHfXJHbrKM1onQYATXKGOj95a oyjbfTQoJt2rtgjKj5ySnPXUduCCPjZl7sr1+bckN49nMowMPd4I8A+4mt1nmWb5dhv3 4LxpGfcYjmBkEEpkYcsoxHQdy895hSAxGA/k8KV7S0q2Q1GEYHkwQs40HAQTs/QgGAbx Q0/vl/OKl9Cde/gFvsuT7RJQIxMlCqtEMSNq/hPnZ4SsQ2BU8bwoSRMROr68fkysonG3 W/R5Z7FeCarmxRwmWalYw83FYilwUFCmtJplZvEspkSlAGMwglKspQ+R5f+qxAGdCgsA 1wxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yK9UTL+y; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 d9si16909677edq.169.2021.07.12.00.24.13; Mon, 12 Jul 2021 00:24:14 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=yK9UTL+y; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S243719AbhGLH0U (ORCPT + 12 others); Mon, 12 Jul 2021 03:26:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:34004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343564AbhGLHYM (ORCPT ); Mon, 12 Jul 2021 03:24:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B4AAF61403; Mon, 12 Jul 2021 07:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074465; bh=YS150Zw3EMrfbg7HTU/kACgheRdPjXylbhg3QzhH4fA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yK9UTL+yIly9PSATQ95P+UkH7dq/qNGXMvy2aHeFSFQJKd+mQdPRKUTlu079UtOWK odjkwC/ra9XULEiy4dl5mn+njZR9fFakValcX7RbOIYeLpYb0oH2W/ogVeSm/5T3lD UhVTyk0CZfE2YXiLAb/UB5gCehga1UtRxcK8HKVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Zhen Lei , Sasha Levin Subject: [PATCH 5.12 590/700] visorbus: fix error return code in visorchipset_init() Date: Mon, 12 Jul 2021 08:11:13 +0200 Message-Id: <20210712061038.757820471@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhen Lei [ Upstream commit ce52ec5beecc1079c251f60e3973b3758f60eb59 ] Commit 1366a3db3dcf ("staging: unisys: visorbus: visorchipset_init clean up gotos") assigns the initial value -ENODEV to the local variable 'err', and the first several error branches will return this value after "goto error". But commit f1f537c2e7f5 ("staging: unisys: visorbus: Consolidate controlvm channel creation.") overwrites 'err' in the middle of the way. As a result, some error branches do not successfully return the initial value -ENODEV of 'err', but return 0. In addition, when kzalloc() fails, -ENOMEM should be returned instead of -ENODEV. Fixes: f1f537c2e7f5 ("staging: unisys: visorbus: Consolidate controlvm channel creation.") Reported-by: Hulk Robot Signed-off-by: Zhen Lei Link: https://lore.kernel.org/r/20210528082614.9337-1-thunder.leizhen@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/visorbus/visorchipset.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/drivers/visorbus/visorchipset.c b/drivers/visorbus/visorchipset.c index cb1eb7e05f87..5668cad86e37 100644 --- a/drivers/visorbus/visorchipset.c +++ b/drivers/visorbus/visorchipset.c @@ -1561,7 +1561,7 @@ schedule_out: static int visorchipset_init(struct acpi_device *acpi_device) { - int err = -ENODEV; + int err = -ENOMEM; struct visorchannel *controlvm_channel; chipset_dev = kzalloc(sizeof(*chipset_dev), GFP_KERNEL); @@ -1584,8 +1584,10 @@ static int visorchipset_init(struct acpi_device *acpi_device) "controlvm", sizeof(struct visor_controlvm_channel), VISOR_CONTROLVM_CHANNEL_VERSIONID, - VISOR_CHANNEL_SIGNATURE)) + VISOR_CHANNEL_SIGNATURE)) { + err = -ENODEV; goto error_delete_groups; + } /* if booting in a crash kernel */ if (is_kdump_kernel()) INIT_DELAYED_WORK(&chipset_dev->periodic_controlvm_work,