2012-08-08 12:47:33

by Marina Makienko

[permalink] [raw]
Subject: [PATCH] blk: All obtained blk requests should be put after all

blk requests are obtained (some memory is allocated for them) by means of functions blk_get_request and blk_make_request. After usage (usually with help of blk_execute_rq) these requests should be put (and freed) with help of blk_put_request.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Marina Makienko <[email protected]>
---
drivers/block/paride/pd.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 831e3ac..528a9a5 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -723,6 +723,11 @@ static int pd_special_command(struct pd_unit *disk,

rq = blk_get_request(disk->gd->queue, READ, __GFP_WAIT);

+ if (!rq) {
+ sdev_printk(KERN_INFO, sdev, "get_req: blk_get_request failed");
+ return NULL;
+ }
+
rq->cmd_type = REQ_TYPE_SPECIAL;
rq->special = func;

--
1.7.7