Commit 9dfe1cc3 authored by Christof Schmitt's avatar Christof Schmitt Committed by James Bottomley

[SCSI] zfcp: Fix mempool pointer for GID_PN request allocation

When allocating memory for GID_PN nameserver requests, the allocation
function stores the pointer to the mempool, but then overwrites the
pointer via memset. Later, the wrong function to free the memory will
be called, since this is based on the stored pointer.

Fix this by first initializing the struct and then storing the pointer.
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarMartin Peschke <mp3@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent d26ab06e
...@@ -1533,19 +1533,16 @@ zfcp_gid_pn_buffers_alloc(struct zfcp_gid_pn_data **gid_pn, mempool_t *pool) ...@@ -1533,19 +1533,16 @@ zfcp_gid_pn_buffers_alloc(struct zfcp_gid_pn_data **gid_pn, mempool_t *pool)
{ {
struct zfcp_gid_pn_data *data; struct zfcp_gid_pn_data *data;
if (pool != NULL) { if (pool)
data = mempool_alloc(pool, GFP_ATOMIC); data = mempool_alloc(pool, GFP_ATOMIC);
if (likely(data != NULL)) { else
data->ct.pool = pool;
}
} else {
data = kmem_cache_alloc(zfcp_data.gid_pn_cache, GFP_ATOMIC); data = kmem_cache_alloc(zfcp_data.gid_pn_cache, GFP_ATOMIC);
}
if (NULL == data) if (NULL == data)
return -ENOMEM; return -ENOMEM;
memset(data, 0, sizeof(*data)); memset(data, 0, sizeof(*data));
data->ct.pool = pool;
sg_init_table(&data->req , 1); sg_init_table(&data->req , 1);
sg_init_table(&data->resp , 1); sg_init_table(&data->resp , 1);
data->ct.req = &data->req; data->ct.req = &data->req;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment