From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) (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 5CBEE3939DB for ; Wed, 25 Feb 2026 10:58:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.68 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772017133; cv=none; b=Q94jgCyXjSqRFh7hbGGRJ9t2v//jvIW3/sdWjVte1kg+gjLTnQU55O6rs72tQqp3AhVDMIUl0qr39sjofnNPKty+FxaK2tphUFT1S64PiC3u2zKQ4hgz3k5w/kx9CRqfxBqDfF8zIks3Voibn4DP7E/gScgakB07CCM4Fct957o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772017133; c=relaxed/simple; bh=DPQ/B0yNcFKdxTDFMr/6BjzBWJxZRyvE01ySyp+G1Gg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OT7TomzjWZdeVNdl/8oiQHJx/FaJ77KY/p/UkgdRSK8zGzpWtyXg3RqpvKKx3GixwC3t3a5E7lL+ixaDMGF3FaqoyFe43fqbS7cCcw8jEoaLg7skOvteLVDg/X17jeYt2NQVZad6g/m2jhrEk+uMn+/s6IL+ug4yaxKb0OXDinU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=J9eYSS4U; arc=none smtp.client-ip=209.85.221.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="J9eYSS4U" Received: by mail-wr1-f68.google.com with SMTP id ffacd0b85a97d-4376c0bffc1so4904807f8f.0 for ; Wed, 25 Feb 2026 02:58:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772017131; x=1772621931; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=VIdRCk7t4GWQocuOik2n76ea1IYJUFZ1loDMZ8piecQ=; b=J9eYSS4UQR9nKC5YqxSoDnYWv4R+Js1MrQTKqQl+nxqfu4TFgr9RMxWJMChmAcjVOS fJ+cjdTHDymKhI/mOxhDAgPKrnsEHpwpGQn+z2/qpx4o0BeOrURhq7pKCihYIq+X17zW 49doZq7qi3sRQpl9reqrDU2ygAD1llJcG92iVfD0YPqdTs61DwcADxk+sTAuO7QQdqDP UUbmPd9LwqS8NGRGHLDQ1kcQUVS2kOEwTVyt/PTnEwbKRIPI0V2YwoScdvOFIYKv2zBQ QI5mDZ/JSRfuNYuesWiC4sFMeJ3SG5mJoaHKHW6a2YhbtDM2PnNCLZTsPyQVPXWbuI2r 42DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772017131; x=1772621931; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VIdRCk7t4GWQocuOik2n76ea1IYJUFZ1loDMZ8piecQ=; b=QGCqaIHN4O52Ql9lcWgoro2jX5g84C6GMEf9iWUKi2TUUmkBkvFPiUmMMwi6GIv5b+ qI6dTmYbop3XHfBAzmwHsra2Lc2cbkRoNt8RYmnRMVf0WQjW60T6APJZGtqiNYQ+lQBr 6nEBOzvnUC9ZaHQLKHFNwjFVEoVxbqhD9PNs7K00EiV7E+GGFhTvZ4LBw4ov+uomKc8u NoTt2q6JT4tXknsNlh89WhOk/va4/hpKBIu2iMCc3RxmOsY53up3AyOQ9apzSBdC84qB mfmgYzJJMTR9d+fssh8DjFgiSpmgNUTAw0wecOPhYB/s6paXuhabVCf1gH6lXFvjbez4 0uOw== X-Forwarded-Encrypted: i=1; AJvYcCVvs38/yolI2RasWcxhGeA2UrSwnvYxEw2WPJWJpyuNIwnBSVis8P84YJ6aflMyjFqijYYGT/tLtPgE03M=@vger.kernel.org X-Gm-Message-State: AOJu0Ywes3UpbYjxy/7EnSljtmgk1fw5OqmS0O6us41t30p8Wcq4s5Xo uk03GC83gup78Sh9uDCxbDNTV8ca9egNuQQq/CVEN5XwqUEDngGWFvQCrX2Hk2qYUHw= X-Gm-Gg: ATEYQzzFXDbnGqzeLC9tpCR/IhFGLNuSwFSuKeCoRyHTRK4fdLIuH2kvawDCDSYI2Rb jXvQvyuvvH/3DIayluJB/ky7B/qZSN5zEJUVWldHgPvOoOiKKPiOZu3kThOgKd/sTR6T0sofhyh zFfYrxVXDDSKJQgvrWGN1wwcB0axYefsVUfXIlYq8yIVFe3MSfkLAr/kKH1MoH/F6pOUvBC4igC 78dEDxUhsxRO3upzYKZzcDcrjw4zdBcmeSFo2+L1oTXnC0Kt7LBQ2N77urkoOxvoUhhPRjvHCQj E893BZudBuNOoAUW+iSedyEQelPhOQrsVCxwUmLoghcLFM3BBYhjG9Af/ArXV2Qz54NV8ewYLSK PMfm/R9J+nGzYXmwF1tDdBlxw50A7jm+ver9wF/xLC07jJ0WOD2NkT8EfA1RihHUmXop+gB0pJo HyuQ8LpngtCMtd+bswUWryDIl6Hq8= X-Received: by 2002:a5d:5885:0:b0:439:8f9f:4994 with SMTP id ffacd0b85a97d-4398f9f4d4bmr2551757f8f.0.1772017130528; Wed, 25 Feb 2026 02:58:50 -0800 (PST) Received: from localhost ([41.210.147.106]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d4c95dsm36546719f8f.33.2026.02.25.02.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Feb 2026 02:58:50 -0800 (PST) Date: Wed, 25 Feb 2026 13:58:45 +0300 From: Dan Carpenter To: Jiayuan Chen Cc: netdev@vger.kernel.org, Jiayuan Chen , syzbot+72e3ea390c305de0e259@syzkaller.appspotmail.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Ingo Molnar , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH net v1] atm: lec: fix null-ptr-deref in lec_arp_clear_vccs Message-ID: References: <20260224044648.243578-1-jiayuan.chen@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260224044648.243578-1-jiayuan.chen@linux.dev> On Tue, Feb 24, 2026 at 12:46:38PM +0800, Jiayuan Chen wrote: > From: Jiayuan Chen > > syzkaller reported a null-ptr-deref in lec_arp_clear_vccs(). > This issue can be easily reproduced using the syzkaller reproducer. > > In the ATM LANE (LAN Emulation) module, the same atm_vcc can be shared by > multiple lec_arp_table entries (e.g., via entry->vcc or entry->recv_vcc). > When the underlying VCC is closed, lec_vcc_close() iterates over all > ARP entries and calls lec_arp_clear_vccs() for each matched entry. > > For example, when lec_vcc_close() iterates through the hlists in > priv->lec_arp_empty_ones or other ARP tables: > > 1. In the first iteration, for the first matched ARP entry sharing the VCC, > lec_arp_clear_vccs() frees the associated vpriv (which is vcc->user_back) > and sets vcc->user_back to NULL. > 2. In the second iteration, for the next matched ARP entry sharing the same > VCC, lec_arp_clear_vccs() is called again. It obtains a NULL vpriv from > vcc->user_back (via LEC_VCC_PRIV(vcc)) and then attempts to dereference it > via `vcc->pop = vpriv->old_pop`, leading to a null-ptr-deref crash. > > Fix this by adding a null check for vpriv before dereferencing it. If > vpriv is already NULL, it means the VCC has been cleared by a previous > call, so we can safely skip the cleanup and just clear the entry's > vcc/recv_vcc pointers. Note that the added check is intentional and > necessary to avoid calling vcc_release_async() multiple times on the > same vcc/recv_vcc, not just protecting the kfree(). > > Reported-by: syzbot+72e3ea390c305de0e259@syzkaller.appspotmail.com > Closes: https://lore.kernel.org/all/68c95a83.050a0220.3c6139.0e5c.GAE@google.com/T/ > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Jiayuan Chen > --- > net/atm/lec.c | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) > > diff --git a/net/atm/lec.c b/net/atm/lec.c > index afb8d3eb2185..a5b80d6df603 100644 > --- a/net/atm/lec.c > +++ b/net/atm/lec.c > @@ -1260,24 +1260,27 @@ static void lec_arp_clear_vccs(struct lec_arp_table *entry) > struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc); > struct net_device *dev = (struct net_device *)vcc->proto_data; > > - vcc->pop = vpriv->old_pop; > - if (vpriv->xoff) > - netif_wake_queue(dev); > - kfree(vpriv); > - vcc->user_back = NULL; > - vcc->push = entry->old_push; > - vcc_release_async(vcc, -EPIPE); > + if (vpriv) { > + vcc->pop = vpriv->old_pop; > + if (vpriv->xoff) > + netif_wake_queue(dev); > + kfree(vpriv); > + vcc->user_back = NULL; > + vcc->push = entry->old_push; > + vcc_release_async(vcc, -EPIPE); > + } > entry->vcc = NULL; > } > if (entry->recv_vcc) { > struct atm_vcc *vcc = entry->recv_vcc; > struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc); > > - kfree(vpriv); > - vcc->user_back = NULL; > - > - entry->recv_vcc->push = entry->old_recv_push; > - vcc_release_async(entry->recv_vcc, -EPIPE); > + if (vpriv) { > + kfree(vpriv); > + vcc->user_back = NULL; > + vcc->push = entry->old_recv_push; > + vcc_release_async(vcc, -EPIPE); I wasn't going say anything, but since it seems like maybe you're going to redo this patch anyway. Changing "entry->recv_vcc->push" to "vcc->push" is obviously nice but could you do that in a separate patch? I use a tool to strip out the indenting changes: https://github.com/error27/rename_rev So when I review a patch like this, I want to pipe it to my script and just see: + if (vpriv) { vcc->pop = vpriv->old_pop; if (vpriv->xoff) netif_wake_queue(dev); kfree(vpriv); vcc->user_back = NULL; vcc->push = entry->old_push; vcc_release_async(vcc, -EPIPE); + } entry->vcc = NULL; } if (entry->recv_vcc) { struct atm_vcc *vcc = entry->recv_vcc; struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc); + if (vpriv) { kfree(vpriv); vcc->user_back = NULL; entry->recv_vcc->push = entry->old_recv_push; vcc_release_async(entry->recv_vcc, -EPIPE); + } The renames are nice but now I have to check things by hand. regards, dan carpenter