Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp2060781rdb; Tue, 5 Sep 2023 13:09:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHimgkfLC+Y+tc+ejcg/et5UumJjQ2tQE1tKEwqZGWO4LY5dxwrWTd/v5UeUYiBdSKTA0Us X-Received: by 2002:a17:902:b615:b0:1c0:cf84:c9d2 with SMTP id b21-20020a170902b61500b001c0cf84c9d2mr11287499pls.8.1693944556394; Tue, 05 Sep 2023 13:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693944556; cv=none; d=google.com; s=arc-20160816; b=FqJ3LQOBhMRz6pkIWA1KEA8zHg/A1ggFci5dzzrF5UyH8DJfBVGWqRbZYtuDoKwHuv yHuHf69onAzJ4dccytQtpMzDbqsBcH1tL79KSlzkI1hg9hXUae1t5+PyS+KexNQ3PfAW /R0phMXNHFJDqjkcKRZNEhEmLiXXr3680DRkKt/wNI9hessYSfUIVJBGO+tUd9CuuQTL RrfV4FteW0y8FyxaXvlpIC0S5LTkQBKHguZfIH6DF5gCmZBTNvW6PAECE29QoE5L6FSi LpfXncspRoXrCl1YCjPVY0Z8VS8TaxH12ieeB4LqtVDe8H1Vg2Qjmcyr8oUGLtyGxItn Y4qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=HW2Ja6DBsGF0IBV5Ok78yH3T2cMRRXxBnRTgOhDLuWw=; fh=5/EhUlrfA8U9Xfs3X1KF8Hg+pB7IlYtb7hECPxzsdUI=; b=A+07rMIgnOrBFS7KLQ4wRL9TaiHj0n+0tk1rhP7rIr/kWP7GCCZeXde2Zw8sXz85g/ aUkl+ggkqwoQg8uwZBgjmG2smZDUfkF9e7TpzvYcyB/mb2Uce1cOEsnJ1OKLpIZ2fBkR yqbOeQQd26h2DtlUg/DdCPLqjbe9jrCCLg/lTlfDa/qmncD8PoaEBSyd1I5T68JsWaV0 mCgI07RCHmkVSs+0M6687SVJjADfab13O0KmetGYFN65hXQMydO9KSgfqQhoLnbxSgDl lJ4MhlxPnJzeH+O05Ow/pu0PJsT+Vjpys2V4Qfo0P7aGgciS3BRXVOvTty28UEr2StfR EdCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a17090adc0200b0024e47fae466si9911310pjv.180.2023.09.05.13.09.01; Tue, 05 Sep 2023 13:09:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346375AbjIEQ4l (ORCPT + 99 others); Tue, 5 Sep 2023 12:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354228AbjIEKMc (ORCPT ); Tue, 5 Sep 2023 06:12:32 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB0CC18D for ; Tue, 5 Sep 2023 03:12:28 -0700 (PDT) Received: from lhrpeml500004.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Rg1X40rn0z6K6Kj; Tue, 5 Sep 2023 18:12:20 +0800 (CST) Received: from mscphis00759.huawei.com (10.123.66.134) by lhrpeml500004.china.huawei.com (7.191.163.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 5 Sep 2023 11:12:26 +0100 From: Konstantin Meskhidze To: CC: , , , , Subject: [PATCH] ubifs: fix possible dereference after free Date: Tue, 5 Sep 2023 18:12:22 +0800 Message-ID: <20230905101222.1725230-1-konstantin.meskhidze@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.123.66.134] X-ClientProxiedBy: mscpeml100002.china.huawei.com (7.188.26.75) To lhrpeml500004.china.huawei.com (7.191.163.9) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'old_idx' could be dereferenced after free via 'rb_link_node' function call. Fixes: b5fda08ef213 ("ubifs: Fix memleak when insert_old_idx() failed") Co-developed-by: Ivanov Mikhail Signed-off-by: Konstantin Meskhidze --- fs/ubifs/tnc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 6b7d95b65f4b..f4728e65d1bd 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c @@ -64,8 +64,9 @@ static void do_insert_old_idx(struct ubifs_info *c, p = &(*p)->rb_right; else { ubifs_err(c, "old idx added twice!"); kfree(old_idx); + return; } } rb_link_node(&old_idx->rb, parent, p); rb_insert_color(&old_idx->rb, &c->old_idx); -- 2.34.1