Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2224130rdb; Fri, 8 Dec 2023 01:46:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMtW7UF/usywNo1KF8FFlBMu5FkIvgzJG5yzvfPvfJobM8D2G2cc3NWZ3ysCYmHPFSzQDk X-Received: by 2002:a17:90a:ec15:b0:288:7921:a745 with SMTP id l21-20020a17090aec1500b002887921a745mr3307112pjy.15.1702028765897; Fri, 08 Dec 2023 01:46:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702028765; cv=none; d=google.com; s=arc-20160816; b=HGdm0iZPqX0OOs3huiPB6nAjwKKFH76BS15PO7W9WdIsdCTUc31FLtk5DFNbjaiGIH hE9RH7E2W5+KVffImkt8DjZkbsu91zK38axb1SK9Ie9RsQqFTOa4e4NPwfmGHNwO6a8y 4b4yxmuLGL5x+tUZe7+C8imy+gs3KFk51Zua3tjaxy+bryk8qu3hQBrA+MM/m7pMserp 1Vf75N05Lp350a5cHH96O0cDXHZadRSO8hZ4BleuT+yyjJxfFIa01zZ4SagDQRie+yfc arpf+9tj17pz0iD36OXI57qagAN61FZLl3PKexcLEPH8/yk0gT+5RaNkRgQZ442HkYYF a/SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:message-id:in-reply-to:date :mime-version; bh=VAjnMRUxSxfpb3qrgmgdoXzAqWKDHCjSJPqxcRRXhMM=; fh=V9AeBafJgTW96HdC48wsxGAfd7Fe9P2uAL8tLCjpUN4=; b=W3i05+kHpWrBxzpStfNFDrofpsGKa6bTVjHjESH5rbU2uXxn4eoDP6ap+sQeEuUySc SNGBb0ZA4oH4ygtUpK07OLSoNKg4pwnKN6S/frB+vnqOy68QX3APxSxwdGG/1LEmnPYY F91U7uQktPv85FWKzC1rTK1oO6AFdYGsfUrqQmjb2Jm37JqSwmu19UQ5hfKWrIdCjilp IKR2FLSL3SdBKJPhlwv4jCAGX4AayZRkwIczwstim2S7Ryxi+kEc2u5YVywlygcUYkTV ta2zXfx6zkZj4PpAkFsAjfHed2kTaosQM9mu/zuHk3uK3O1pOHIrqj8ivcAYvAQKoYjz dAAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id f10-20020a170902ce8a00b001d0ac4424cesi1404464plg.138.2023.12.08.01.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 01:46:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id D98F983741E0; Fri, 8 Dec 2023 01:46:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233242AbjLHJpi (ORCPT + 99 others); Fri, 8 Dec 2023 04:45:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230457AbjLHJph (ORCPT ); Fri, 8 Dec 2023 04:45:37 -0500 Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D42E690 for ; Fri, 8 Dec 2023 01:45:43 -0800 (PST) Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-1fafbf42404so3430617fac.1 for ; Fri, 08 Dec 2023 01:45:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702028743; x=1702633543; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VAjnMRUxSxfpb3qrgmgdoXzAqWKDHCjSJPqxcRRXhMM=; b=N/QoSoNo58HZc0BVcFlhU80nqWP99H1Agtt4JMw1QJ6TOSJBQg4uavy9Sjky6QZ7/f 8bOjkmwI3u6+mOIg44Gvu4aIWw2endt9wjJAci+C4G40HO9m0L8tCSC1olXmRD8625L7 GQeUtGg0jQCeLEIIb172M1+zgFuxNeOmY8IGLeeJkRHEMnWQ3Q/WVSbMk7OSMyC9X/Ye v5di/8C9+T7icYqrn482K5wuoyT03kOOMRY2lubJwCrauC8TmnKaN2u6UnUf4j+/kJuo KST2Fh0oDzCNGz07sjtQB+AyJYXNrwi9cnHVQrwIQFg5jGE217R1kABSMnBL62AuJ9oD +sQQ== X-Gm-Message-State: AOJu0YwvQ6nhfwC6ZEEH0f3BQdSnwCtaJYEnDY+feoeZyzG+gGtIs8vN DjfvGdhjJ41J0x3axVAFfl9OOJd2zYR0LfjInDWB2WmcZPU+r2A= MIME-Version: 1.0 X-Received: by 2002:a05:6870:2409:b0:1fa:ed68:afc1 with SMTP id n9-20020a056870240900b001faed68afc1mr5100367oap.4.1702028743280; Fri, 08 Dec 2023 01:45:43 -0800 (PST) Date: Fri, 08 Dec 2023 01:45:43 -0800 In-Reply-To: <000000000000bfba3a060bf4ffcf@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <000000000000a414b7060bfc72b3@google.com> Subject: Re: [syzbot] [arm-msm?] [net?] memory leak in radix_tree_insert From: syzbot To: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=1.1 required=5.0 tests=FROM_LOCAL_HEX, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 08 Dec 2023 01:46:03 -0800 (PST) X-Spam-Level: * For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org. *** Subject: [arm-msm?] [net?] memory leak in radix_tree_insert Author: lizhi.xu@windriver.com #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 33cc938e65a9 diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 976b9bd02a1b..b98e9f2c24ac 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -55,6 +55,8 @@ struct kmem_cache *radix_tree_node_cachep; #define IDR_MAX_PATH (DIV_ROUND_UP(IDR_INDEX_BITS, \ RADIX_TREE_MAP_SHIFT)) #define IDR_PRELOAD_SIZE (IDR_MAX_PATH * 2 - 1) +static bool __radix_tree_delete(struct radix_tree_root *root, + struct radix_tree_node *node, void __rcu **slot); /* * Per-cpu pool of preloaded nodes @@ -714,8 +716,10 @@ int radix_tree_insert(struct radix_tree_root *root, unsigned long index, return error; error = insert_entries(node, slot, item); - if (error < 0) + if (error < 0) { + __radix_tree_delete(root, node, slot); return error; + } if (node) { unsigned offset = get_slot_offset(node, slot); -- 2.43.0