Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3241

kernel-2.6.18-194.11.1.el5.src.rpm

From: Hans-Joachim Picht <hpicht@redhat.com>
Date: Fri, 23 May 2008 13:41:42 +0200
Subject: [s390] zfcp: out-of-memory handling for status_read req
Message-id: 20080523114142.GA22964@redhat.com
O-Subject: [RHEL5 U3 PATCH 2/2] s390 - zfcp: Out-of-memory handling for status_read requests
Bugzilla: 447726
RH-Acked-by: Pete Zaitcev <zaitcev@redhat.com>

Description
============

zfcp can run out of status_read buffers during low-memory situations.
If the allocation of memory for a status_read failes, this
is incorrectly reported as success (return code 0) and
not as error.

Solution: Fix the return code handling to return the memory allocation
failure as -ENOMEM.

Bugzilla
=========

BZ 447726
https://bugzilla.redhat.com/show_bug.cgi?id=447726

Upstream status of the patch:
=============================

The patch is included in linux-2.6 as git commit
8627533c115c546649693d68fed6a74762c47d51

Test status:
============

The patch has been tested and fixes the problem.
The fix was verified by the IBM test team.

Please ACK.

With best regards,

        --Hans

diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index be113ec..fa7398f 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -714,7 +714,7 @@ zfcp_fsf_status_read(struct zfcp_adapter *adapter, int req_flags)
 	struct fsf_status_read_buffer *status_buffer;
 	unsigned long lock_flags;
 	volatile struct qdio_buffer_element *sbale;
-	int retval = 0;
+	int retval;
 
 	/* setup new FSF request */
 	retval = zfcp_fsf_req_create(adapter, FSF_QTCB_UNSOLICITED_STATUS,
@@ -733,12 +733,11 @@ zfcp_fsf_status_read(struct zfcp_adapter *adapter, int req_flags)
         sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY;
         fsf_req->sbale_curr = 2;
 
+	retval = -ENOMEM;
 	status_buffer =
 		mempool_alloc(adapter->pool.data_status_read, GFP_ATOMIC);
-	if (!status_buffer) {
-		ZFCP_LOG_NORMAL("bug: could not get some buffer\n");
+	if (!status_buffer)
 		goto failed_buf;
-	}
 	memset(status_buffer, 0, sizeof (struct fsf_status_read_buffer));
 	fsf_req->data = (unsigned long) status_buffer;