From patchwork Mon Jul 19 14:50:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 479947 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4242927jao; Mon, 19 Jul 2021 08:41:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoT/oDYVimU1+7Sc7QplrtSvtJYlKQHBHV12PtV65wFw0du2ufvveXFhN7Jb8rhlsiAvp1 X-Received: by 2002:a92:cac5:: with SMTP id m5mr17446558ilq.112.1626709272810; Mon, 19 Jul 2021 08:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626709272; cv=none; d=google.com; s=arc-20160816; b=jyP88pZqcYKbb42F6Jq/5J9mCLNcayxN5oApzWDUqMzQo4J0u7RU98xwWLkjjMVPm/ zX5jq9o+OOrsAgCfmCcenoG4ZWQ7MULHBVS4+4BheX3xWRksZpmH9y+1g4LkpqIzaquZ gbp5R7E+hRNOY7Lu5eQAElPllccA0PUysh2vwPZ7z1vMxk4d9YtKcXoiAoSC3nhl7G8+ e8vtLFF6/mfiDzqVIiKHaubzCAd+0tARhfypIOVl/MFWjZ2kAO3QiY6PfjcRfWJkOo9Q rQ5elXFFpSAHPG3C4jowcb0k1zD4Xu1Ins7ZY4nvxR1y7283bhjKfKmSx0EPpzgGqqGR S1rA== 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=mq9kKX5RZMM9OKMQ8AaVqYViU1ldeZuFlHvJDh2REDnQpzxtMoZPDFiKlfmsIGpM7T GPpixcLsed/wItFVFO3uF/KL0/4C4X04RNBSAvNRalT39RvJteyia69vrgS7VbJ1Jj+T Q3vrQ36ouy+hNPlaPqv6e5BkixwFck3InehiDq+DT0c+ojr0k3RxqQ3nLdOxcI8cG+m5 k8reO7HLXlZa/syu6vOJsL/Y6pDhDufRbCGxTNVDrfANAfHy+jkD5um60VsQ/ob90Zr6 md1acmCfh4A/8yqloGO+7J71LTUGZiHTbWtGCn7eFrGCTUMil3lqykn63IPylYQQDkYR 5Kig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hz9Ml3WA; 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 ay16si21406520jab.96.2021.07.19.08.41.12; Mon, 19 Jul 2021 08:41:12 -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=hz9Ml3WA; 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 S245735AbhGSO7C (ORCPT + 12 others); Mon, 19 Jul 2021 10:59:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:53798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245317AbhGSO6O (ORCPT ); Mon, 19 Jul 2021 10:58:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 65B9B613E3; Mon, 19 Jul 2021 15:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626708950; bh=YS150Zw3EMrfbg7HTU/kACgheRdPjXylbhg3QzhH4fA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hz9Ml3WAziLtrLzPwgnP4OHzbM1vYUtNu9ibEwQTqNZoPQ58P1J44MhL3AwQsANQ+ n9SU5J1gug3LWtJZUW3RGS5MJw+CbUn6/Ct/E5cY7mfwIcw+FLluyGTHkMmlYxl3QV Rth7g7/xGFC4yiQed0PcmEqbKQ2GD/Kz9vtyMiVo= 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 4.19 195/421] visorbus: fix error return code in visorchipset_init() Date: Mon, 19 Jul 2021 16:50:06 +0200 Message-Id: <20210719144953.156227594@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144946.310399455@linuxfoundation.org> References: <20210719144946.310399455@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,