From nobody Sat Feb 7 17:54:44 2026 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6D8B3090C6 for ; Fri, 16 Jan 2026 03:40:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768534818; cv=none; b=uouXAnPu/eMH+Dw94CHjV+DzUval+ImruULo6w7vKlZIad0Pd6VDD0hkHZeNnI6ApoYTCTlPTOLffwcdKAf9d/wjzHNTqPyOZLZNq8jJi65LM+GFFhRK1eERQ8nms+2nDVD/meuNcPfbhueYT9AB6R7VI5R/L2gXcZNqunvtnzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768534818; c=relaxed/simple; bh=5Pk368yfaXBv3ePkCYYl5BQSgpqivSevIAbWwc/lzRk=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=efNp68sJW4hy71oNxPwDksfVt9jCl+OLVpOlDi8RbloMy4jEpaoZ8/S+4nDmnceHNEu4wUeZS7G6yJUaPkUcGbD05Qo7ns2sJbcKC+RNedtCOSdm/dQCieYZJwJ0AUFcDIMvpPnhaLAIwIEo7IVSdY8wkvVkzLFLNo/IZpTKEDY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.210.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-7c702d1a4f7so4951133a34.3 for ; Thu, 15 Jan 2026 19:40:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768534816; x=1769139616; 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=2yuXSdvnNNDTug52JOirBF9XrQdAw3v+n22kaZU6v4Q=; b=OtWHBanmJ0bL/3Wnz3xI6l822ZzeDnzPaZYirp+ju8/9JMFrn8b4O81k3C6qp94CCp x1WHbArB1BG9Fub+q2Zs1ImPOBtquhPTDBv0Q8owdhIDx+J8MyPhqMYmmlTAiXCaODlL M6xs5oVUA4jZlsMMlXwhKs6R9tfRp0Aa5UEkpzQKl/+drb5k6QWF0Ox8ssV2Rrtt/gk6 dVtHdZKNmOe8jNimGG5po9W3gKkg1Pf6l4hMa6yK6HCUIpwdN+djTT171JF8maj73DHH jo+pP9ROCd6ZpchwQLkAf8rbQdX+j8hdq/48jH1dnryqYOZACl3XCZV55E/5NExo5pb6 Ywhw== X-Gm-Message-State: AOJu0YyEFMPWee2qPBS++0kRk/cFB3bWU3SyoJvz8sggjke4Dup7Fqe4 rV41klJh6GNvqJLm50DOggV62JL2sg4zugc3Hc1pQAFWE0ecZDDypvcnDVfNoQbyTVZ236wuosK XU9fx1GfcB+080XYnhU58X9SDACINKioc7hXYwildAZMvciD3JQKewI6SjRw= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:188c:b0:659:9a49:8fe4 with SMTP id 006d021491bc7-6611793d305mr777056eaf.17.1768534815794; Thu, 15 Jan 2026 19:40:15 -0800 (PST) Date: Thu, 15 Jan 2026 19:40:15 -0800 In-Reply-To: <69694849.050a0220.58bed.0025.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6969b31f.050a0220.58bed.003a.GAE@google.com> Subject: Forwarded: [PATCH] netrom: fix memory leak in nr_add_node() From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] netrom: fix memory leak in nr_add_node() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master When nr_add_node() creates a new neighbor but the route quality is too low to be added (node already has 3 routes with better quality), the newly allocated neighbor is never used but remains in the neighbor list with refcount=3D1, causing a memory leak. Also fix the same leak in the error path when nr_node allocation fails after creating a new neighbor. Fix by tracking whether a new neighbor was allocated and removing it from the list if it was not used (count =3D=3D 0) or on allocation failure. Reported-by: syzbot+3f2d46b6e62b8dd546d3@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D3f2d46b6e62b8dd546d3 Signed-off-by: Deepanshu Kartikey --- net/netrom/nr_route.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index b94cb2ffbaf8..a1591a8f8456 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c @@ -100,6 +100,7 @@ static int __must_check nr_add_node(ax25_address *nr, c= onst char *mnemonic, { struct nr_node *nr_node; struct nr_neigh *nr_neigh; + bool new_neigh =3D false; int i, found; struct net_device *odev; =20 @@ -172,6 +173,7 @@ static int __must_check nr_add_node(ax25_address *nr, c= onst char *mnemonic, } } =20 + new_neigh =3D true; spin_lock_bh(&nr_neigh_list_lock); hlist_add_head(&nr_neigh->neigh_node, &nr_neigh_list); nr_neigh_hold(nr_neigh); @@ -183,8 +185,11 @@ static int __must_check nr_add_node(ax25_address *nr, = const char *mnemonic, =20 if (nr_node =3D=3D NULL) { if ((nr_node =3D kmalloc(sizeof(*nr_node), GFP_ATOMIC)) =3D=3D NULL) { - if (nr_neigh) + if (nr_neigh) { + if (new_neigh) + nr_remove_neigh(nr_neigh); nr_neigh_put(nr_neigh); + } return -ENOMEM; } =20 @@ -279,6 +284,9 @@ static int __must_check nr_add_node(ax25_address *nr, c= onst char *mnemonic, } } =20 + if (new_neigh && nr_neigh->count =3D=3D 0) + nr_remove_neigh(nr_neigh); + nr_neigh_put(nr_neigh); nr_node_unlock(nr_node); nr_node_put(nr_node); --=20 2.43.0