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 1CE2C4772B8; Fri, 7 Aug 2026 15:36:37 +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=1786116998; cv=none; b=q71LxyD7mIPhPmTL48ntTBrkj7ZQ4gB9qdJ8I8eTzKpdbmYz3L7TMY5BE5wXHKwYo0356jvnpQ90frfC+LvJ1nbUDZqlcWTZzHVgWDlcnQPlS+RqMz56PC+eT75Itw0ZMgyVke3B+PqLm31AX7JHur8pW0Io2PbRkEfTh8LVuhM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786116998; c=relaxed/simple; bh=Pn4X9mm/dItKtirNuTmgErHjlFQ9VKtlKpdCJjuCayk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=foS26AetOEisvnY4C1KJU73FWlpavnbUB7MksCP62F65/BvvoW7QpYv0H2kyrzFAKBYM8xXBzPD9hI9sHBaVg3p36VKqC7nLtEcJ1Gn25WmenJFYjIx4JiefXEGhFwZZ4M1V9pDMfI2ZQhBNdBF5XT8sCtd23hNpvkdx8xzGbGM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yFyxQVBn; 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="yFyxQVBn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A0A41F000E9; Fri, 7 Aug 2026 15:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786116997; bh=3oknRBUX08rRnzZBg83pLWmA+jyOR00s+TZSaY26c6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yFyxQVBnSJKFllO6Ku9zvrvMMlGntySqJVV68XLObvYyh6mb7IqAYtKm6WfZQlaEN Zy9jpbFIk4LRAlR+6GdizDPpQeWjsEzOLTSupGt41CVntVeqpjaM8ICdV3th1Po0eT v4cdLto5AGiO5nPOetKRe0nEsPC9Pzk8LeJnULpA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yichong Chen , David Howells , Paulo Alcantara , netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, "Christian Brauner (Amutable)" , Sasha Levin Subject: [PATCH 7.1 119/438] netfs: handle single writeback rolling buffer allocation failure Date: Fri, 7 Aug 2026 16:35:15 +0200 Message-ID: <20260807143430.530666588@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143428.008222056@linuxfoundation.org> References: <20260807143428.008222056@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 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yichong Chen [ Upstream commit 37a1c535c80c67d98668d190c7432f9ebda43310 ] netfs_write_folio_single() takes an extra folio reference before appending the folio to the rolling buffer. rolling_buffer_append() can fail if it cannot allocate another folio_queue. Check the return value and drop the extra folio reference before returning the error. Fixes: 49866ce7ea8d ("netfs: Add support for caching single monolithic objects such as AFS dirs") Signed-off-by: Yichong Chen Signed-off-by: David Howells Link: https://patch.msgid.link/20260727130716.1099906-3-dhowells@redhat.com cc: Paulo Alcantara cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner (Amutable) Signed-off-by: Sasha Levin --- fs/netfs/write_issue.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c index d0d884731dc5d..8d3a6cad42d5e 100644 --- a/fs/netfs/write_issue.c +++ b/fs/netfs/write_issue.c @@ -731,6 +731,7 @@ static int netfs_write_folio_single(struct netfs_io_request *wreq, size_t iter_off = 0; size_t fsize = folio_size(folio), flen; loff_t fpos = folio_pos(folio); + ssize_t ret; bool to_eof = false; bool no_debug = false; @@ -759,7 +760,11 @@ static int netfs_write_folio_single(struct netfs_io_request *wreq, /* Attach the folio to the rolling buffer. */ folio_get(folio); - rolling_buffer_append(&wreq->buffer, folio, NETFS_ROLLBUF_PUT_MARK); + ret = rolling_buffer_append(&wreq->buffer, folio, NETFS_ROLLBUF_PUT_MARK); + if (ret < 0) { + folio_put(folio); + return ret; + } /* Move the submission point forward to allow for write-streaming data * not starting at the front of the page. We don't do write-streaming -- 2.53.0