From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C9051EA84; Sun, 21 Dec 2025 12:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766319613; cv=none; b=ZJekq+HnwVRs5a/FrkfBWaAJG910BJ4hUVvll+fR5AHqTjvusu9MXKWHgTS+isz+y1oO38LuUHK+NecXE5uPL1qUcEhTTHzDqstHI9J1L1uLEmoTr1ixCsRjIgCmH0ydD0xiHZb5NoJ6kQBkWsaKjKaRCZPnX3zg+hel045r22c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766319613; c=relaxed/simple; bh=m6XP9NnkPXQPIv2dNC2D6DrymrSzN2QNtzVvhAX/ROw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oYOeYd1JcftvRXaoeN2iphRQ9xpkPRp8ZklqECInMUx/zZircCWLiVBCvUULIcTpe3DBxenoLWLxi5E9mNm4KtUpVWjg8uiJ+kbucHA6gMu2Yoe2QFXrguApt8h1w2joIYJhCncpZj8smX8LrsHw5gk+r+W5OXphZ+KTYUUfHUY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kroah.com; spf=pass smtp.mailfrom=kroah.com; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b=rDaPagDR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=GC2eoEGk; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kroah.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kroah.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="rDaPagDR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GC2eoEGk" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 0B4F914000A7; Sun, 21 Dec 2025 07:20:10 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sun, 21 Dec 2025 07:20:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1766319610; x=1766406010; bh=WRIruBPBZm 27NQWvBEtT7qTRyArxWxry3ZuRyxHcIj8=; b=rDaPagDRcUA3wq2lXsXCHY9e6c PSm33+H8kGChoaJcG7ydMRqiuGUtwykQSBGJBKNfPzubCP1otzSR0D+7E3r3zOfO Y1CmgQ7gnB/z38fTEIbNerDLxkrvb6H3TZA94EhgUTkpBFiinsZ8Vucmbnmx0xiz zCDwZnGrQtd7CPaHv3T+3x6L7NKlp2TrHBGWLjLspJ/tHfBF997sIFQbFI2AZAPT 094NFLrMUgsAn7dWqe6aGvvRgzv/RfG+o3+ro5QwbFZiB5PZNfjXwCQ/8rVSqAZl Y4PWoWSDc2Vtn2IwgSsNBniqMelKqILyqkVyig0vIBIvsTLxW+KNzOuyBAKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1766319610; x=1766406010; bh=WRIruBPBZm27NQWvBEtT7qTRyArxWxry3Zu RyxHcIj8=; b=GC2eoEGkdQBe5kM5Xxti/Bgackl6RtlAbLRsBZxuA8XSaURcDuG kMx5NNlFEJEPYr7hcPIlnoTcHgywEkDFoZQgB6eG912dzthmUUoBEQd4JUlWH7gE vre/+stCQXYwqBlbYXcZNHNsNhLIvPXvcFCD8EI9mlN6qfFVJi0RsffN2ZcuUR3S uKUHHayzzuzK7vP4Vbufm+R3IIcVSDN/Zcz+t4MEQr1Z+v3aZzF2DCT/8QmFidSY 4Bfj+C710PTAivjDdXXaHHa1ye6YUeAhE2kwLSxAgsF248S4bCB0q8qDkutUZjYP U94hcLUQjKSxo8nvBW2jemA5UVZXut80Hmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdehgedtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefirhgvghcumffj uceoghhrvghgsehkrhhorghhrdgtohhmqeenucggtffrrghtthgvrhhnpeehgedvvedvle ejuefgtdduudfhkeeltdeihfevjeekjeeuhfdtueefhffgheekteenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtg homhdpnhgspghrtghpthhtohepudeipdhmohguvgepshhmthhpohhuthdprhgtphhtthho pehlihhhrghogihirghnghesihhsrhgtrdhishgtrghsrdgrtgdrtghnpdhrtghpthhtoh epmhhpohhrthgvrheskhgvrhhnvghlrdgtrhgrshhhihhnghdrohhrghdprhgtphhtthho pegrlhgvgidrsghouhelsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghkphhmsehlih hnuhigqdhfohhunhgurghtihhonhdrohhrghdprhgtphhtthhopegurghnrdgtrghrphgv nhhtvghrsehlihhnrghrohdrohhrghdprhgtphhtthhopehlihhnuhigsehtrhgvsghlih hgrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtohepshhtrggslhgvsehvghgvrhdrkhgvrhhnvghlrdhorh hg X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 21 Dec 2025 07:20:08 -0500 (EST) Date: Sun, 21 Dec 2025 13:20:07 +0100 From: Greg KH To: Haoxiang Li Cc: mporter@kernel.crashing.org, alex.bou9@gmail.com, akpm@linux-foundation.org, dan.carpenter@linaro.org, linux@treblig.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] rapidio: fix a resource leak when rio_add_device() fails Message-ID: <2025122135-shudder-corrosive-480a@gregkh> References: <20251221120538.947670-1-lihaoxiang@isrc.iscas.ac.cn> Precedence: bulk X-Mailing-List: stable@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: <20251221120538.947670-1-lihaoxiang@isrc.iscas.ac.cn> On Sun, Dec 21, 2025 at 08:05:38PM +0800, Haoxiang Li wrote: > If rio_add_device() fails, call rio_free_net() to unregister > the net device registered by rio_add_net(). > > Fixes: e8de370188d0 ("rapidio: add mport char device driver") > Cc: stable@vger.kernel.org > Signed-off-by: Haoxiang Li > --- > drivers/rapidio/devices/rio_mport_cdev.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c > index 995cfeca972b..4a804b4ad6f7 100644 > --- a/drivers/rapidio/devices/rio_mport_cdev.c > +++ b/drivers/rapidio/devices/rio_mport_cdev.c > @@ -1789,6 +1789,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv, > err = rio_add_device(rdev); > if (err) { > put_device(&rdev->dev); > + rio_free_net(net); > return err; Are you sure this is right? You aren't checking that rio_add_net() was actually called. How was this tested? How was this found? What tool was used to find it? thanks, greg k-h