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 1F9BCC432C0 for ; Tue, 3 Dec 2019 22:49:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D04E620656 for ; Tue, 3 Dec 2019 22:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413369; bh=F66DdngBL+vukpTMT7DM9xZJGVecvMvU+cdbojN7Lrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=RHbQdByQEwxmBaWhHkJ8YnePBcd8fh4Psa2boNK74TmkXPRWK1OtEITSjOl6K1IdF QaG+JEssx2v2z1A5x+U0v7T0WbnpNl7Zz+S+6z717KWWw+H2/4MgB8kMFud2x4kiE9 pcrDLHQl4I/0WVGtFxrCWuRT6L7YYmBy4fY5SQdo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729607AbfLCWt2 (ORCPT ); Tue, 3 Dec 2019 17:49:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:40466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729598AbfLCWt0 (ORCPT ); Tue, 3 Dec 2019 17:49:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 5D44C20803; Tue, 3 Dec 2019 22:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413365; bh=F66DdngBL+vukpTMT7DM9xZJGVecvMvU+cdbojN7Lrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QU8wSzI/7cOk694p7ep0B8KjtoMmB4hub41ud0Z82+r6aTB89fL/CQOuK4WJOFQX9 rCHtAP/wDYsUVsBdG6xraRqbkxLjtJ9IkAOhp1z2zeqppFWImmzkWdBqXeB3ATOC9M L21AIltBlQJBc1GpvApNZffvWXVsdkZCruD0PAIs= 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.19 101/321] ubi: Do not drop UBI device reference before using Date: Tue, 3 Dec 2019 23:32:47 +0100 Message-Id: <20191203223432.409992040@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203223427.103571230@linuxfoundation.org> References: <20191203223427.103571230@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 e9e9ecbcedcc3..0b8f0c46268da 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