Skip to content

Commit bf36507

Browse files
oberparAlexander Gordeev
authored andcommitted
s390/sclp: Prevent release of buffer in I/O
When a task waiting for completion of a Store Data operation is interrupted, an attempt is made to halt this operation. If this attempt fails due to a hardware or firmware problem, there is a chance that the SCLP facility might store data into buffers referenced by the original operation at a later time. Handle this situation by not releasing the referenced data buffers if the halt attempt fails. For current use cases, this might result in a leak of few pages of memory in case of a rare hardware/firmware malfunction. Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Peter Oberparleiter <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent ecec74b commit bf36507

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/s390/char/sclp_sd.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,14 @@ static int sclp_sd_store_data(struct sclp_sd_data *result, u8 di)
324324
&esize);
325325
if (rc) {
326326
/* Cancel running request if interrupted */
327-
if (rc == -ERESTARTSYS)
328-
sclp_sd_sync(page, SD_EQ_HALT, di, 0, 0, NULL, NULL);
327+
if (rc == -ERESTARTSYS) {
328+
if (sclp_sd_sync(page, SD_EQ_HALT, di, 0, 0, NULL, NULL)) {
329+
pr_warn("Could not stop Store Data request - leaking at least %zu bytes\n",
330+
(size_t)dsize * PAGE_SIZE);
331+
data = NULL;
332+
asce = 0;
333+
}
334+
}
329335
vfree(data);
330336
goto out;
331337
}

0 commit comments

Comments
 (0)