Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp655756imu; Tue, 27 Nov 2018 19:24:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/WA0zqNrnvFrD4OMxhgg+L1esxBMrmtCGn45hJpvseLVhpWcP/oWvFgUK2i7T9BKvh841fS X-Received: by 2002:a17:902:25ab:: with SMTP id y40-v6mr34706568pla.258.1543375454566; Tue, 27 Nov 2018 19:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543375454; cv=none; d=google.com; s=arc-20160816; b=gE4+73gVZDOeeQrGGEFZuhUVsaVxom5xDoITCjzg902udXitBOCddT35SvJAmuncjl EZdPc0dYus2RxyHcvuFEZpx0A0/gAtvJqJk8y3gYC5jhj0JP0KCK9RUtJWraiSll6em+ xXFPXsDejRtLeGSupW1QR/95oYnoU592cugDH9KalqISumPPO9CDIUMslkc5gcbSFZd/ KhWH5BVyDjqImRg4ud3CNacit/bkcDkmPJV2DFrsGt1zy6OGFt5C+qTiwsmLTyGWAz/U tbY5uUgn/e8tiDyHuQJg3AwTbxkJfQpGVj/WTyYUdKxd2xbSYofU4NdGnzi+VGczNkc2 GXxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=ITOznSn5bQ58RWLkTeWjlqppC3foqi5QhYIlals98a4=; b=Wqv7LKwVHZDKkvyovsxLhtncG7czhmXoGm14uEEKYd0MpQ5jXgsuzE8jAidOnlA3kQ 6g4wYGma+fsWHvfgNx1G8eCac4k75XUm5p4vGnUFoaJjs6yGmnWcKJ2nnyxxMFzT8Yem 8BTXqTUGUTn8qGHDnheJZ7ecBu7hmBTz0wQpQkrJgmkpctCVa7R3pq6AxeB2CPo9eBdE 1XnNwynfHcLBmnvsKnOssI10jQMA5gd23Xk+DThuxmxIBfA1WqVV2p53TWLx84aNcziB 3OSWt6MpUfRn5OexSrobfflsZBMVy+HN4rjPuuXnDSFyBxq1W8j9q/0WctKG5oeI49v8 iodQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=pYN9w2fS; 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 w7si1486486pgh.560.2018.11.27.19.23.59; Tue, 27 Nov 2018 19:24:14 -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=@163.com header.s=s110527 header.b=pYN9w2fS; 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 S1727247AbeK1OUu (ORCPT + 99 others); Wed, 28 Nov 2018 09:20:50 -0500 Received: from m12-17.163.com ([220.181.12.17]:40975 "EHLO m12-17.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726847AbeK1OUu (ORCPT ); Wed, 28 Nov 2018 09:20:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=ITOznSn5bQ58RWLkTe WjlqppC3foqi5QhYIlals98a4=; b=pYN9w2fShkpa8iNJ7jqwwqG6ltDR/S68/7 mftKKva9Nr265I8l8B30CFFgwhwWqD0BEJLmjPsMclq3KmCzbu9bZYwNZmw9/TCm mXruAN3gLDMDBjHT7kTRL+pGvWWfm6emDNTmYuHGQ5Gg2N30EVtXgL4lU3od9Vg8 2KBpgl6zg= Received: from bp.localdomain (unknown [106.120.213.96]) by smtp13 (Coremail) with SMTP id EcCowACnRHZhCf5beSCwBw--.43667S3; Wed, 28 Nov 2018 11:20:03 +0800 (CST) From: Pan Bian To: Artem Bityutskiy , Richard Weinberger , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH] ubi: do not drop UBI device reference before using Date: Wed, 28 Nov 2018 11:20:03 +0800 Message-Id: <1543375203-97876-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: EcCowACnRHZhCf5beSCwBw--.43667S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr4UKr15Aw1DXF47Zw13urg_yoWfKwb_WF yxZFnIqr40gr18Kw1Sqr4fZFyI9FyY9F4IkF12g395Wayjgry5uFyvqr97ZFW7ZryIya4D Zr12vw45Gr43KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU0G9aJUUUUU== X-Originating-IP: [106.120.213.96] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBzwUNclaD0cQdXAAAs0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 e9e9ecb..0b8f0c4 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.7.4