Received: by 10.192.165.156 with SMTP id m28csp1112197imm; Wed, 11 Apr 2018 12:39:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx48gV2YTolGhmO5WuEjpYGbmJ0NptUZk3hJ+Gq3LPyyRJmoeoLUlh6NFzlPH+IsLQ2XXjFKd X-Received: by 2002:a17:902:51ce:: with SMTP id y72-v6mr6349713plh.157.1523475541785; Wed, 11 Apr 2018 12:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523475541; cv=none; d=google.com; s=arc-20160816; b=VlVeTkFWfjlcIRBogynEaPmnntatuxM3/RNAt6tC8ngwYjRGvZxFS7o7LSlmq0JDG8 DKBHWE3a/mL7g0zz0Pq7hgB4QMXZQ0bl81/IFxVcpHQmMr9GYHEXcRn0AYvnCthDWD0i 5S6fDqULxNTNF/L3zH42gyLz6eWMOIwX7KdlJvSvB1FWdE/9afPUh9cO0QY7mh8mRLoE MwHQ9vbuPinCZ3GN6d6uq8S7GXxsbtZ8fLrUVaqqySWuNeYLAs2ssxPXb/InU3ndMT2b 8ux7ufkE+D1Y3n20GtytxrOqlMyPn+Tjp9GMMJOJvdOrOQOgaa86DWB6LMcoKRoy7PM9 VZrQ== 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=Dgua/7V+TR/yiK+k8PuDEttPjPhI4jfJvlrMcLchBR4=; b=nAXpN76GtCMBtnmabNXVtXZsmR4xYBfeh7K2iTLRhFXeNgDHbMZsLBqEDMGjY5vSbu T3UJ8wh2OP5D7yXebaK051fUQRTgFauMERb1aWLxUZOtTCb3zUT//P3B36B7xfppBnR5 cHN/k1PN29+IW+452AN47V7BypAkFw4Tzqsi5qK1qzMLdmG0FcpFPjhkFVHHOmM0GceU AJwpmX7SUuY5NA+DkXCYP2G92WozgXHykGhBWDSdtbMb0QMYX7w7QwdfMDmLFwvRgNJj jP+NYsucFytnUBV+mYM+RT/lkIaaTCKtiDU80B5sMyh4wyyJh764D+ruv55sxIg3PZhN OFPg== 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 e6si1125338pgn.473.2018.04.11.12.38.24; Wed, 11 Apr 2018 12:39:01 -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 S934420AbeDKTCP (ORCPT + 99 others); Wed, 11 Apr 2018 15:02:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38438 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934381AbeDKTCK (ORCPT ); Wed, 11 Apr 2018 15:02:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7294DDAC; Wed, 11 Apr 2018 19:02:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Frederic Barrat , Michael Ellerman , Sasha Levin Subject: [PATCH 4.9 207/310] cxl: Unlock on error in probe Date: Wed, 11 Apr 2018 20:35:46 +0200 Message-Id: <20180411183631.474994847@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 58d876fa7181f2f393190c1d32c056b5a9d34aa2 ] We should unlock if get_cxl_adapter() fails. Fixes: 594ff7d067ca ("cxl: Support to flash a new image on the adapter from a guest") Signed-off-by: Dan Carpenter Acked-by: Frederic Barrat Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/misc/cxl/flash.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/misc/cxl/flash.c +++ b/drivers/misc/cxl/flash.c @@ -401,8 +401,10 @@ static int device_open(struct inode *ino if (down_interruptible(&sem) != 0) return -EPERM; - if (!(adapter = get_cxl_adapter(adapter_num))) - return -ENODEV; + if (!(adapter = get_cxl_adapter(adapter_num))) { + rc = -ENODEV; + goto err_unlock; + } file->private_data = adapter; continue_token = 0; @@ -446,6 +448,8 @@ err1: free_page((unsigned long) le); err: put_device(&adapter->dev); +err_unlock: + up(&sem); return rc; }