public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Max Kellermann <max.kellermann@ionos.com>
To: amarkuze@redhat.com, xiubli@redhat.com, idryomov@gmail.com,
	ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org, Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH] fs/ceph/file: fix memory leaks in __ceph_sync_read()
Date: Wed, 27 Nov 2024 22:20:27 +0100	[thread overview]
Message-ID: <20241127212027.2704515-1-max.kellermann@ionos.com> (raw)

In two `break` statements, the call to ceph_release_page_vector() was
missing, leaking the allocation from ceph_alloc_page_vector().

Cc: stable@vger.kernel.org
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
 fs/ceph/file.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 4b8d59ebda00..24d0f1cc9aac 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1134,6 +1134,7 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos,
 			extent_cnt = __ceph_sparse_read_ext_count(inode, read_len);
 			ret = ceph_alloc_sparse_ext_map(op, extent_cnt);
 			if (ret) {
+				ceph_release_page_vector(pages, num_pages);
 				ceph_osdc_put_request(req);
 				break;
 			}
@@ -1168,6 +1169,7 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos,
 					op->extent.sparse_ext_cnt);
 			if (fret < 0) {
 				ret = fret;
+				ceph_release_page_vector(pages, num_pages);
 				ceph_osdc_put_request(req);
 				break;
 			}
-- 
2.45.2


             reply	other threads:[~2024-11-27 21:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 21:20 Max Kellermann [this message]
2024-11-28 12:17 ` [PATCH] fs/ceph/file: fix memory leaks in __ceph_sync_read() Alex Markuze
2024-11-28 12:28   ` Max Kellermann
2024-11-28 12:31     ` Max Kellermann
2024-11-28 12:48       ` Alex Markuze
2024-11-28 13:11         ` Max Kellermann
2024-11-29  8:06   ` Max Kellermann
2024-12-05  8:32     ` Max Kellermann
2024-12-05 11:24       ` Ilya Dryomov
2024-12-05 11:31         ` Alex Markuze
2024-12-05 12:02           ` Max Kellermann
2024-12-05 12:17             ` Alex Markuze
2024-12-05 12:32               ` Max Kellermann
2024-12-05 12:22             ` Max Kellermann
2024-12-05 12:57               ` Alex Markuze
2024-12-05 13:08                 ` Max Kellermann
2024-12-05 15:12                   ` Ilya Dryomov
2024-12-05 15:37                     ` Max Kellermann
2024-12-05 15:42                       ` Max Kellermann
2024-12-05 15:49                     ` [PATCH v2] " Max Kellermann
2024-12-05 16:30                       ` Alex Markuze
2024-12-06 12:50                         ` Ilya Dryomov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241127212027.2704515-1-max.kellermann@ionos.com \
    --to=max.kellermann@ionos.com \
    --cc=amarkuze@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xiubli@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox