From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B1B7C2BEFEB; Thu, 25 Jun 2026 13:07:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782392833; cv=none; b=HFPOpUbwywdHQ8idWl2MACmVxZBJnlNudLfSQamutEVOOblr2Mkg+JNiBkA/QaNJjfF29VpRFYw6l4X/kdkQ0DBUjOPNJyBO/rteZEQaKp9jV4b6A8H/oUHv0AUraTVYT/+XtATIgkUdbbMhcswsvPuZIs463wEIFc9btgdXo/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782392833; c=relaxed/simple; bh=26ciyC5UtP2Pl8xzNnFrGEh6AaLwdz41qAo1jSV6EJ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bkMY2TobDtd1tMLW7/Ru3uzPDrRFwS0Um+vQlWuJ+jWEH9J4ptzafq+h9B/78TDNrE815R0mCO58MyQhQdUUpnKNS+3mTgd9sKtTl0Lmy291/BLU8GUPNkZn0DI8JDwmhxbkzMZhrIj3zYjUhfLlrS5CFgHKxY3s1NeC7TlPxUQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=t9lp1VNB; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="t9lp1VNB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01A7D1F000E9; Thu, 25 Jun 2026 13:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1782392832; bh=EaL25P+h1D4aONrFw0Cb7OpmGyUUciMtJHDbPCO+Jpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=t9lp1VNBwIAy66YI9vSQ/5m7SYHeBiq3aPwZqXg4Rc0GY+CE0d2ONuwzJnlgw53Ok KwVJ2fBTHCjJXsLNyga1mqVOWaW1z2FmA3JgXnrPc461uHROC2JcNne0HHeJsIvBJf yHx/C6YNMWJ1yQLsf5NUDH5alRt/AkLMZ6DFdR34= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bernard Pidoux Subject: [PATCH 6.18 23/60] rose: fix netdev double-hold in rose_make_new() Date: Thu, 25 Jun 2026 14:03:08 +0100 Message-ID: <20260625125648.957773009@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260625125645.554579168@linuxfoundation.org> References: <20260625125645.554579168@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bernard Pidoux commit b9fb21ceb4f0d043767a1eba60786ec84809033b upstream. rose_make_new() copies orose->device from the listener socket and calls netdev_hold(), storing the tracker in rose->dev_tracker. The only caller, rose_rx_call_request(), then overwrites both make_rose->device and make_rose->dev_tracker with a fresh netdev_hold() for the actual incoming-call device. This orphans the tracker allocated by rose_make_new(): it remains in the device's refcount_tracker list but no pointer exists to free it via netdev_put(). The result is one spurious outstanding reference per accepted CALL_REQUEST, visible at rmmod time as: ref_tracker: netdev@X has 2/2 users at rose_rx_call_request+0xba3/0x1d50 [rose] rose_loopback_timer+0x3eb/0x670 [rose] The second entry is the orphaned tracker from rose_make_new(); the first is the correctly-managed socket reference from rose_rx_call_request(). Fix: initialise rose->device to NULL in rose_make_new() and let rose_rx_call_request() -- the sole caller -- assign the correct device and take the sole netdev_hold() as it already does. Signed-off-by: Bernard Pidoux Signed-off-by: Greg Kroah-Hartman --- net/rose/af_rose.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -631,9 +631,7 @@ static struct sock *rose_make_new(struct rose->hb = orose->hb; rose->idle = orose->idle; rose->defer = orose->defer; - rose->device = orose->device; - if (rose->device) - netdev_hold(rose->device, &rose->dev_tracker, GFP_ATOMIC); + rose->device = NULL; /* rose_rx_call_request() sets this */ rose->qbitincl = orose->qbitincl; return sk;