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=ham 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 D8F1DC43603 for ; Wed, 4 Dec 2019 18:18:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF4D420675 for ; Wed, 4 Dec 2019 18:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575483512; bh=9FiMZ05AyP9vz7NADwi6aGobRVfRNQnwiHXVl7PW3TM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xIvSA4EZgBYRpBAoxQfnb8oBpAHx0XtSZNNImvo5QXU2R9vHYfxY+0DxYjm7exp8w 1NsBFE0Cc9C5gY5q7Xv0vG4H3ysApRjNRXwU5Vg922U9xQv+6ZdBeL/0/7QHGmxRR3 WFMy21mKjktMwphfbL5Tu73QwbAaMcI9cucTKID8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729420AbfLDSSb (ORCPT ); Wed, 4 Dec 2019 13:18:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:38604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731324AbfLDSKu (ORCPT ); Wed, 4 Dec 2019 13:10:50 -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 B755220674; Wed, 4 Dec 2019 18:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575483050; bh=9FiMZ05AyP9vz7NADwi6aGobRVfRNQnwiHXVl7PW3TM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rszgw9KYMNuK8mhNTu4sh6yg/9SPYWKZwfjh+TQiiMKLOS43DfnvPKwo+fLWdNihP 0oWObN/ezM61MYAH6ziM4p3CEl9+48GMMp3xL+qJ8QIwrOZfq1bCSpISyVr3gkwk0r 5Q0y450NhibkZovc+IWkhLhmu0DpLzB8gjhvEVeQ= 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.9 030/125] ubi: Do not drop UBI device reference before using Date: Wed, 4 Dec 2019 18:55:35 +0100 Message-Id: <20191204175320.478059871@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175308.377746305@linuxfoundation.org> References: <20191204175308.377746305@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 88b1897aeb40f..7826f7c4ec2fb 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