All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iov_iter: fix return type of __pipe_get_pages()
@ 2018-05-02 18:16 Ilya Dryomov
  2018-05-02 18:16 ` [PATCH 2/2] iov_iter: fix memory leak in pipe_get_pages_alloc() Ilya Dryomov
  0 siblings, 1 reply; 3+ messages in thread
From: Ilya Dryomov @ 2018-05-02 18:16 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel

It returns -EFAULT and happens to be a helper for pipe_get_pages()
whose return type is ssize_t.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 lib/iov_iter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 970212670b6a..4d5bf40d399d 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1012,7 +1012,7 @@ unsigned long iov_iter_gap_alignment(const struct iov_iter *i)
 }
 EXPORT_SYMBOL(iov_iter_gap_alignment);
 
-static inline size_t __pipe_get_pages(struct iov_iter *i,
+static inline ssize_t __pipe_get_pages(struct iov_iter *i,
 				size_t maxsize,
 				struct page **pages,
 				int idx,
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] iov_iter: fix memory leak in pipe_get_pages_alloc()
  2018-05-02 18:16 [PATCH 1/2] iov_iter: fix return type of __pipe_get_pages() Ilya Dryomov
@ 2018-05-02 18:16 ` Ilya Dryomov
  2018-05-02 18:40   ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Ilya Dryomov @ 2018-05-02 18:16 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel

Make n signed to avoid leaking the pages array if __pipe_get_pages()
fails.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 lib/iov_iter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 4d5bf40d399d..fdae394172fa 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1102,7 +1102,7 @@ static ssize_t pipe_get_pages_alloc(struct iov_iter *i,
 		   size_t *start)
 {
 	struct page **p;
-	size_t n;
+	ssize_t n;
 	int idx;
 	int npages;
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] iov_iter: fix memory leak in pipe_get_pages_alloc()
  2018-05-02 18:16 ` [PATCH 2/2] iov_iter: fix memory leak in pipe_get_pages_alloc() Ilya Dryomov
@ 2018-05-02 18:40   ` Al Viro
  0 siblings, 0 replies; 3+ messages in thread
From: Al Viro @ 2018-05-02 18:40 UTC (permalink / raw)
  To: Ilya Dryomov; +Cc: linux-kernel

On Wed, May 02, 2018 at 08:16:57PM +0200, Ilya Dryomov wrote:
> Make n signed to avoid leaking the pages array if __pipe_get_pages()
> fails.

Applied, with s/fails/& to allocate any pages/.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-02 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02 18:16 [PATCH 1/2] iov_iter: fix return type of __pipe_get_pages() Ilya Dryomov
2018-05-02 18:16 ` [PATCH 2/2] iov_iter: fix memory leak in pipe_get_pages_alloc() Ilya Dryomov
2018-05-02 18:40   ` Al Viro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.