Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4595026pja; Thu, 21 Nov 2019 22:31:08 -0800 (PST) X-Google-Smtp-Source: APXvYqyxVIvgorwL8wazAcYsypWxp4dAvW5z5ZAirYSe6MH+KxgZ2nojlX1KC4f3f7THCPLAWGph X-Received: by 2002:a17:906:1983:: with SMTP id g3mr19887899ejd.84.1574404268554; Thu, 21 Nov 2019 22:31:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574404268; cv=none; d=google.com; s=arc-20160816; b=jyEe1dBptrswH9snTtsrppToQ/NwPPiyhFG/j+u5baTon3Re6tipLc5X2+feB2eqOp kn5blWQyVzzFwIae4LApudmscEUiIJ1r3IWHKapWt9/VETVAqexR4BjjlzbDwTIBS1jn D4wESu0DWMgjippZzpdtOqXnQ+9NLbUCv+9dTMQSRUNH9X7Hfp4tCstaSzbvVKWI9dKy T/D5NibAujmVlBjRQ3QvdzFYf62aOVsWEUODGQtVUqjYxIqpsGCVp5wh0lMRn1SsXMPK R6t6zbpu2epOKJ47z5Ucc0LUG1+e/a+1G7zqye/wRocPpYCCv4Al/buaAoEpyHA5wXvM 5nfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RX5xXZj5WWh3LkkUJu9P+FpP+05j/Zf7mHxh4YAJ18A=; b=eMyfWB+s78n5sKChdzTN3NeM6u4gwBXRViyRd1iypec8SGnbXtxoEsdDU/SzFtA0Fe 5BGL4TwPnD3ClJUcylPxMF//Zq5sjTnFeXw1pyDKGqZC5r9E8r11RCrHNlGJdhUlnxgN /kSgrxN3jn+BRPZKvfvb/TH7HQjhFZxk5GeuJzE/V3lc6oseschxryXIoW6cdoPZwDpR 6xiAjQwq9QMXAzlod6qHhkZPhY/EQkUxbGkF0aHWsV7cKsLfhBiejbllM+YEELmwd4cq M5dgWHUOIrCCPJsmEeAHvv7JDEXn7gfMSNBQ2Vu3qkCqNcLsaKKSoj42YelTvanQ81tw 1R3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=voc0qooy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4si3481321ejr.90.2019.11.21.22.30.44; Thu, 21 Nov 2019 22:31:08 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=voc0qooy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727574AbfKVFuQ (ORCPT + 99 others); Fri, 22 Nov 2019 00:50:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:54622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727538AbfKVFuL (ORCPT ); Fri, 22 Nov 2019 00:50:11 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 493432070E; Fri, 22 Nov 2019 05:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574401811; bh=ox+jk7ejkHNusLkSVH1D1TnF4JEMqPUC8DpY3z5P1do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=voc0qooyg2b5Afn8/GyFSGUtV8v1KCaT3bXxa0B0m4G3D6bAhWaWI/HJ5YS7YHfUj eFCGsSLr+6PSwJhFko9zojAibDwEVoM5n1G4Whi8Yeu1tH8Wevbj9BvMBpTn/iHuuO NROzJmy2eWtrAmk7j8y2RhcW7hGA5mkIo+OfHJqo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pan Bian , Boris Brezillon , Richard Weinberger , Sasha Levin , linux-mtd@lists.infradead.org Subject: [PATCH AUTOSEL 4.19 055/219] ubi: Do not drop UBI device reference before using Date: Fri, 22 Nov 2019 00:46:27 -0500 Message-Id: <20191122054911.1750-48-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122054911.1750-1-sashal@kernel.org> References: <20191122054911.1750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian [ Upstream commit e542087701f09418702673631a908429feb3eae0 ] The UBI device reference is dropped but then the device is used as a parameter of ubi_err. The bug is introduced in changing ubi_err's behavior. The old ubi_err does not require a UBI device as its first parameter, but the new one does. Fixes: 32608703310 ("UBI: Extend UBI layer debug/messaging capabilities") Signed-off-by: Pan Bian Reviewed-by: Boris Brezillon Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- drivers/mtd/ubi/kapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index e9e9ecbcedcc3..0b8f0c46268da 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c @@ -227,9 +227,9 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode) out_free: kfree(desc); out_put_ubi: - ubi_put_device(ubi); ubi_err(ubi, "cannot open device %d, volume %d, error %d", ubi_num, vol_id, err); + ubi_put_device(ubi); return ERR_PTR(err); } EXPORT_SYMBOL_GPL(ubi_open_volume); -- 2.20.1