Skip to contentSkip to conversation

Patch "fix a page leak in vhost_scsi_iov_to_sgl() error recovery" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Nov 27, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

fix a page leak in vhost_scsi_iov_to_sgl() error recovery

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
fix-a-page-leak-in-vhost_scsi_iov_to_sgl-error-recovery.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 11d49e9d089ccec81be87c2386dfdd010d7f7f6e Mon Sep 17 00:00:00 2001

From: Al Viro <[email protected]>
Date: Sun, 24 Sep 2017 18:36:44 -0400
Subject: fix a page leak in vhost_scsi_iov_to_sgl() error recovery

From: Al Viro <[email protected]>

commit 11d49e9d089ccec81be87c2386dfdd010d7f7f6e upstream.

we are advancing sg as we go, so the pages we need to drop in case of error are *before* the current sg.

---
 drivers/vhost/scsi.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/vhost/scsi.c +3 -2
@@ -693,6 +693,7 @@ vhost_scsi_iov_to_sgl(struct vhost_scsi_
 		      struct scatterlist *sg, int sg_count)
 {
 	size_t off = iter->iov_offset;
+	struct scatterlist *p = sg;
 	int i, ret;
 
 	for (i = 0; i < iter->nr_segs; i++) {
@@ -701,8 +702,8 @@ vhost_scsi_iov_to_sgl(struct vhost_scsi_
 
 		ret = vhost_scsi_map_to_sgl(cmd, base, len, sg, write);
 		if (ret < 0) {
-			for (i = 0; i < sg_count; i++) {
-				struct page *page = sg_page(&sg[i]);
+			while (p < sg) {
+				struct page *page = sg_page(p++);
 				if (page)
 					put_page(page);
 			}

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/fs-9p-compare-qid.path-in-v9fs_test_inode.patch queue-4.9/fix-a-page-leak-in-vhost_scsi_iov_to_sgl-error-recovery.patch queue-4.9/arm64-implement-arch-specific-pte_access_permitted.patch