summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadhri Jagan Sridharan <badhri@google.com>2018-05-11 00:32:34 +0000
committerAndroid Partner Code Review <android-gerrit-partner@google.com>2018-05-11 00:32:34 +0000
commite440b1425d11460f0cd630e276860123fe9256bd (patch)
tree56a4059a2bcbfe63e5a8b78f748885258a4bf568
parent6c43be24699d6c24fd5bab817332b7063a5530f4 (diff)
parentce1bcff6ed3a64733c4c43848142787ddc5b6485 (diff)
downloadtegra-e440b1425d11460f0cd630e276860123fe9256bd.tar.gz
Merge "UPSTREAM: scsi: sg: don't return bogus Sg_requests" into android-chromeos-dragon-3.18
-rw-r--r--drivers/scsi/sg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 5e59bde491cb..0f274ec7072d 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2056,11 +2056,12 @@ sg_get_rq_mark(Sg_fd * sfp, int pack_id)
if ((1 == resp->done) && (!resp->sg_io_owned) &&
((-1 == pack_id) || (resp->header.pack_id == pack_id))) {
resp->done = 2; /* guard against other readers */
- break;
+ write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
+ return resp;
}
}
write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
- return resp;
+ return NULL;
}
/* always adds to end of list */