diff options
author | Svetlana Mavrina <another.karnil@gmail.com> | 2014-01-12 06:56:09 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-01-23 02:03:59 -0500 |
commit | d9d5713ca628dc211d8b4a1da5fb9e0cfe592b92 (patch) | |
tree | 01d898563ea35fcf7b1f1deea669f3509b9bb839 /drivers/infiniband/hw/amso1100 | |
parent | 05633102d85b50f35325dfbedafcedd6c5b3264c (diff) |
RDMA/amso1100: Add check if cache memory was allocated before freeing it
There is a path in handle_vq() where kmem_cache_free() can be called
with pointer to a local variable. It can happen if vq_repbuf_alloc()
failed to allocate memory from cache and req is NULL.
The patch adds check if cache memory was allocated before freeing it.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Svetlana Mavrina <another.karnil@gmail.com>
Reviewed-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/amso1100')
-rw-r--r-- | drivers/infiniband/hw/amso1100/c2_intr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2_intr.c b/drivers/infiniband/hw/amso1100/c2_intr.c index 8951db4ae29d..3a17d9b36dba 100644 --- a/drivers/infiniband/hw/amso1100/c2_intr.c +++ b/drivers/infiniband/hw/amso1100/c2_intr.c | |||
@@ -169,7 +169,8 @@ static void handle_vq(struct c2_dev *c2dev, u32 mq_index) | |||
169 | * We should never get here, as the adapter should | 169 | * We should never get here, as the adapter should |
170 | * never send us a reply that we're not expecting. | 170 | * never send us a reply that we're not expecting. |
171 | */ | 171 | */ |
172 | vq_repbuf_free(c2dev, host_msg); | 172 | if (reply_msg != NULL) |
173 | vq_repbuf_free(c2dev, host_msg); | ||
173 | pr_debug("handle_vq: UNEXPECTEDLY got NULL req\n"); | 174 | pr_debug("handle_vq: UNEXPECTEDLY got NULL req\n"); |
174 | return; | 175 | return; |
175 | } | 176 | } |