From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D235C43603 for ; Wed, 4 Dec 2019 18:04:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D756A2073B for ; Wed, 4 Dec 2019 18:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482691; bh=YdGv6BHbiAyg5m/uwizGoIGICsNQiynSDOuoUttgDfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wMVnmEXBu6Cw8mJ5hkbquuqRQQzmFv3ag5BxM8bou3n8MEP6pM9973MNyuLbCjJPn gTjxEuy7s+thOQDkEa3Cpl1PgxvHMJjg3KBXdvdUVlP+JGqxTPJtkEt8A2UaCDR1XP O1jh38wuEfpcAIdtpuGrmwnN5ow14AOWHD1T81Go= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730272AbfLDSEu (ORCPT ); Wed, 4 Dec 2019 13:04:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:50416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729039AbfLDSEq (ORCPT ); Wed, 4 Dec 2019 13:04:46 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5EA52073B; Wed, 4 Dec 2019 18:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482686; bh=YdGv6BHbiAyg5m/uwizGoIGICsNQiynSDOuoUttgDfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PBwPJwXB4BcDKUf/7k5jA+m21Ovx8CtG0nqblil0HEEf52KDhTLYSid3Zad0JNAlB jRcfDvC3ZIOuSX4HFWgCQNxen2jaPoMw4DNFKvNppoCn2dK87j7N63cO5AeVegP9oV gqSPdbKKW8DZOfEpF2rjVSt+S7aA0c5phAGsTEow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Boris Brezillon , Richard Weinberger , Sasha Levin Subject: [PATCH 4.14 051/209] ubi: Do not drop UBI device reference before using Date: Wed, 4 Dec 2019 18:54:23 +0100 Message-Id: <20191204175324.889445451@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 d4b2e87444986..c2cf6bd3c162a 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c @@ -227,9 +227,9 @@ out_unlock: 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