Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp2399109rdb; Wed, 6 Sep 2023 03:44:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/xVAEt50I6O/RO12gW+6rNFTJhPUPL1f6dPJGJQ3DFqyaUBGqoNyDusL/QjizVJlQS5uR X-Received: by 2002:a05:6a20:96d8:b0:135:38b5:7e4e with SMTP id hq24-20020a056a2096d800b0013538b57e4emr12687840pzc.59.1693997094502; Wed, 06 Sep 2023 03:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693997094; cv=none; d=google.com; s=arc-20160816; b=x/rsuUqn9fE/q0qY6oNP0mzHTqdzEL5SNmIsG3svPzGAonfp3wOhRlnPXNhXwNGmrE TxFqECiohTDqrLU2LpptPSjACesrRR6BKTz5iAKSTWk/VWp8VsHE0jV1BkvpETNxFX0g UwnfWtvfz5frqrXFo4xU2HabGGg+UXxlzEZrtAviobLFzNQZEU7WZdUxxazAfB1Trugg h0GHKZwFf2QnYjDM9YWQEqsNbMq2Yyg3LWriIROk6sFZSbG0pjh46OvjvQb/7PCTVHml Ru1QhPefdwnd95iXWohCHjkTM8QLkCfRiU0gKMAbZ/CJ54ga9RmuTjhqzuIX73i3rs+I VqAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=PdruBB2Ahh0BSznMwaKtwG/noijdoyLN8c/T+b5JwWQ=; fh=Uq30etavCk4L8HPcG3/On5RhMugnuJdFM1bGIHH3bRY=; b=zEwXDxpufpeAIZ9oLsmWkk8ePrVp7xVym3+HZaURWPBZ23rOdZJH8tgSz2g40MY7N7 0NLr93R5tHqFI8J0tVvMvJy1Lsyo7W/TS85bEzFH1e2XxAO9XBXe+a+D3SwKNvMfR93K l4PZcod4N4npgyEpN63vw4gLrhrJaVXlJg5ULsOc1aq5brvv5JrarzGPe+fDjPlav+X2 0Xv2dlaeQqQtzGEWdVwcwWmRXQGhk8G5Cf1pxBAPKUM0YSSV+n+wCczbHVQMz/OibGHh CBahPKocVaiCcp/6ZhSpr5tTG/E3THFiYgUgv7Dtimlwp7FR4Bj4STS4jGNrEv6yfFsH x7Dw== 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 r15-20020a638f4f000000b00565f5f197adsi1391512pgn.316.2023.09.06.03.44.40; Wed, 06 Sep 2023 03:44:54 -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 S232385AbjIFBmi (ORCPT + 99 others); Tue, 5 Sep 2023 21:42:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbjIFBmg (ORCPT ); Tue, 5 Sep 2023 21:42:36 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CE3C1B3 for ; Tue, 5 Sep 2023 18:42:32 -0700 (PDT) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RgQ4k1j8MztQSC; Wed, 6 Sep 2023 09:38:30 +0800 (CST) Received: from [10.174.178.46] (10.174.178.46) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 6 Sep 2023 09:42:28 +0800 Subject: Re: [PATCH] ubifs: fix possible dereference after free To: Konstantin Meskhidze , CC: , , , References: <20230905101222.1725230-1-konstantin.meskhidze@huawei.com> From: Zhihao Cheng Message-ID: <939c0385-8663-91a2-df20-920f264a2aa1@huawei.com> Date: Wed, 6 Sep 2023 09:42:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20230905101222.1725230-1-konstantin.meskhidze@huawei.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.46] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H5,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 ?? 2023/9/5 18:12, Konstantin Meskhidze ะด??: > '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(+) > Only for static alarms??although it couldn't happen in theory. Reviewed-by: Zhihao Cheng > 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); >