From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 CD6BE3368B1 for ; Fri, 24 Jul 2026 16:09:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784909358; cv=none; b=BtWbpTpyiwoPAIJsNbFf3qAUQDYhzy6BOhzRAG2kXaYX6FweJqdZH4bGL9AfJyk9OwozX4io/UKZRdPdSl5c2M0YKHZodmMiH0XGzlGeJIXtM9AE6HNKkDkpTo4iiyvYpzg6uB3ZbK7rpKVNWo94yVReT0G/R52ekr5qyR76e7M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784909358; c=relaxed/simple; bh=CJEOArTPXr9IotSUugi8Bp0zmzyD0BwH5RCY+dd1pVk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BTqalp2ja+ILTJKawXTs/JYCvlRJrOgjAzQgxdIqObhZxvvMhztNQ9hHz01Za+4NEhom5qbWmLe+zkVXlc5Suo8S9VCfZq2KJn5ei0zeB99D22c3/E6vvcZWiQb0ScnKX9Pl0Y/WQVr8Ox3fXuWmmUkqW1/QPkFTAOROSCGoZ7g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linbit.com; spf=pass smtp.mailfrom=linbit.com; dkim=pass (2048-bit key) header.d=linbit-com.20251104.gappssmtp.com header.i=@linbit-com.20251104.gappssmtp.com header.b=Eoz4oPN8; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linbit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linbit-com.20251104.gappssmtp.com header.i=@linbit-com.20251104.gappssmtp.com header.b="Eoz4oPN8" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4955aa106b1so6959845e9.0 for ; Fri, 24 Jul 2026 09:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linbit-com.20251104.gappssmtp.com; s=20251104; t=1784909353; x=1785514153; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:mail-followup-to:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZtmyGupOuxHpf7w+P2LHQSdMJrugU3vHyUY919jK2Jc=; b=Eoz4oPN8MhOz78YJPvdyq8ohO2wlZbJAL/HhNxVSMAEV2Ach60m9OVI7d7prqhr32t SYeBb7xF2l6kOZZD6drM10D6eVzI2zONh+gvL2lzbSxaMxKVP3WQOytC7I6xoJvAKaa/ v4rp3JNl3BPQ1HwrH3LJeLCNQf1hFY6EPlSwBmLUaOzgyzsQzKoHe7tlfPCWUk99jO5J /arjQ7pCh42VrdWzRfgqdYMKSr3hrMVbaYhHnr1kfJm/cmm/shosyjE3gKx3Iqtbay0j H+WtfoswcA4JyC/b3z+FWhaIVazQZfdcNkvwNVIqXzhU0Ydkj/4pWq1OT/O83Ws7WdSl NEvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784909353; x=1785514153; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:mail-followup-to:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=ZtmyGupOuxHpf7w+P2LHQSdMJrugU3vHyUY919jK2Jc=; b=Ge7E0zUYAp9znPvLagIxgrezWvYJ68Gir8ZJ1t2V+IdTS0OxsILKJB1uI56GC99N+/ GWKPnoLlZdkCGxwp+IY9FxXMrPKsEqX+zkYUcxrTwVkaX1vN6YO017lZfgLKQ3jGg8u6 lsF+GSOlgMiniWbcN4N6Eu3r+ch8wDULsXF1tF7okRCv3/FyPCY+s99sAeCzl+jmQ0dh 6Gl5LTWZLEyZ+u2nNUbZlgnjs0Edn0ZSqW18n/5MBhsSqEDMP0tTWO83ImAE2WSHw0Gd 4tcxpfaQchkcbKRSlEWTxkqttct1SQLHGEQAPXR+NWCsa7cCJNMpqx2citMPxfWcCT98 5Tgg== X-Forwarded-Encrypted: i=1; AHgh+RopKjfRBD/HpoyIUweJppWpoNkBzvmZpW+/f48Je4ohMCvlqpBHgoFs39zV1xFz8vHzOgDStDjfExIXvnQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwGKq6jDV/ag/baQMYymSmgUJ6CoSwq79ZkF/11ROAGCIxdbFX1 PiEAPqqGAVRS64wNM45ye4+ipMkgRbq3Ew9g4fJ9EEGS0pyKOsA3uHp1mqOYtzEGVc7YzNgM5yT L07hQ X-Gm-Gg: AR+sD11mzqaPQtH1BrlC8r44RYVWXSkvam7yFeBBhClGwxT037yC99Q+jxiPH1pzjvO JmyFtluGZOMfnxPM0u+k4Suktipy7x9ZwCY44bujoXbY/P2S3NAGtrDTD4vSPwPi5UfBfhCKcv6 +39PPbjBjamJ1fu8G2L97ru4hCnJtK8psmwBU22YOheDiJ/xi2ukUK8uomxkcgk6CZwxZGD2EM2 8eFtN8wtavredB4pUOwqCNKv5WuRXMW5DjKslD6rp1eafMzEcmuKANBwgt53SgjINj8F3nv7H+P 2RbraW+ABlzc092zL8mW63Kp0fBgq28QK6wXC/w0IprS7tx9JCH2WtuRyJPas0q5qMSQDZCczig TnGdFsSnnN7empphu58P8477TT1435ypIpFkE66qYk5wyjCVh77NBAC0/UrPshkpitCZJiJagnD EKh5MfQUOS1xLqj1rN5MmSRAFVg+bboP78C1KDXPsTaC6NCw== X-Received: by 2002:a05:600c:c05a:b0:495:63f5:7a4f with SMTP id 5b1f17b1804b1-49573d03068mr100199985e9.33.1784909352938; Fri, 24 Jul 2026 09:09:12 -0700 (PDT) Received: from localhost (h082218129081.host.wavenet.at. [82.218.129.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c52fc0sm25103899f8f.23.2026.07.24.09.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 09:09:12 -0700 (PDT) Date: Fri, 24 Jul 2026 18:09:11 +0200 From: Christoph =?utf-8?Q?B=C3=B6hmwalder?= To: Wentao Liang Cc: philipp.reisner@linbit.com, lars.ellenberg@linbit.com, axboe@kernel.dk, drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] drbd: Fix double put_ldev in receive_SyncParam on fifo_alloc failure Message-ID: Mail-Followup-To: Wentao Liang , philipp.reisner@linbit.com, lars.ellenberg@linbit.com, axboe@kernel.dk, drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20260625150417.69968-1-vulab@iscas.ac.cn> 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=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260625150417.69968-1-vulab@iscas.ac.cn> On Thu, Jun 25, 2026 at 11:04:17PM +0800, Wentao Liang wrote: >In receive_SyncParam(), when the fifo_alloc() call for the resync >plan buffer fails, the error path executes put_ldev(device) at line >3790 and then jumps to the disconnect label. The disconnect label >also calls put_ldev(device) when new_disk_conf is non-NULL, which >is always the case by this point (get_ldev succeeded and >new_disk_conf was allocated). > >This results in a double put_ldev, causing the ldev reference count >to underflow. All other goto disconnect sites in the same function >correctly rely solely on the disconnect label to perform the single >put_ldev — the fifo_alloc failure path was the only one to >prematurely release the reference. > >Remove the spurious put_ldev(device) call before goto disconnect >to fix the double put. > >Cc: stable@vger.kernel.org >Fixes: b30ab7913b0a ("drbd: Rename "mdev" to "device"") >Signed-off-by: Wentao Liang >--- > drivers/block/drbd/drbd_receiver.c | 1 - > 1 file changed, 1 deletion(-) > >diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c >index 58b95bf4bdca..f618d03fd2a6 100644 >--- a/drivers/block/drbd/drbd_receiver.c >+++ b/drivers/block/drbd/drbd_receiver.c >@@ -3787,7 +3787,6 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i > new_plan = fifo_alloc(fifo_size); > if (!new_plan) { > drbd_err(device, "kmalloc of fifo_buffer failed"); >- put_ldev(device); > goto disconnect; > } > } >-- >2.39.5 (Apple Git-154) Thanks for the patch, the fix itself looks correct to me. The Fixes tag points at the wrong commit though. b30ab7913b0a is a purely mechanical rename and only carried the existing code forward. The double put was actually introduced by 813472ced7fa ("drbd: RCU for rs_plan_s"), which added the put_ldev() to the disconnect label. So the tag should be: Fixes: 813472ced7fa ("drbd: RCU for rs_plan_s") With that fixed up: Reviewed-by: Christoph Böhmwalder