From: Svetlana Mavrina <another.karnil@gmail.com>
To: tom@opengridcomputing.com
Cc: Svetlana Mavrina <another.karnil@gmail.com>,
swise@opengridcomputing.com, roland@kernel.org,
sean.hefty@intel.com, hal.rosenstock@gmail.com,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
ldv-project@linuxtesting.org
Subject: [PATCH] amso1100: Add check if cache memory was allocated before freeing it
Date: Sun, 12 Jan 2014 11:56:09 +0000 [thread overview]
Message-ID: <1389527769-6602-1-git-send-email-another.karnil@gmail.com> (raw)
From: Svetlana Mavrina <another.karnil@gmail.com>
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>
---
drivers/infiniband/hw/amso1100/c2_intr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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)
* We should never get here, as the adapter should
* never send us a reply that we're not expecting.
*/
- vq_repbuf_free(c2dev, host_msg);
+ if (reply_msg != NULL)
+ vq_repbuf_free(c2dev, host_msg);
pr_debug("handle_vq: UNEXPECTEDLY got NULL req\n");
return;
}
--
1.8.1.2
reply other threads:[~2014-01-12 11:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1389527769-6602-1-git-send-email-another.karnil@gmail.com \
--to=another.karnil@gmail.com \
--cc=hal.rosenstock@gmail.com \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=roland@kernel.org \
--cc=sean.hefty@intel.com \
--cc=swise@opengridcomputing.com \
--cc=tom@opengridcomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox