From: Marina Makienko <makienko@ispras.ru>
To: "David S. Miller" <davem@davemloft.net>
Cc: Marina Makienko <makienko@ispras.ru>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
ldv-project@ispras.ru
Subject: [PATCH 04/13] ide: Potential null pointer dereference in ide_cdrom_reset()
Date: Thu, 9 Aug 2012 17:55:21 +0400 [thread overview]
Message-ID: <1344520529-19164-2-git-send-email-makienko@ispras.ru> (raw)
In-Reply-To: <1344520529-19164-1-git-send-email-makienko@ispras.ru>
The function blk_get_request() can return NULL in some cases. There are
checks on it if function is called with argumetns one of which is
GFP_ATOMIC/GFP_NOIO/etc. If system couldn't find request
blk_get_request() return NULL.
But if there is function call with argument __GFP_WAIT
the system will wait until get request or the queue becomes
dead. If something kills the queue, blk_get_request()
return NULL and next operations will lead to errors.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Marina Makienko <makienko@ispras.ru>
---
drivers/ide/ide-cd_ioctl.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c
index 02caa7d..e29588f 100644
--- a/drivers/ide/ide-cd_ioctl.c
+++ b/drivers/ide/ide-cd_ioctl.c
@@ -304,6 +304,10 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi)
int ret;
rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
+
+ if (!rq)
+ return -EIO;
+
rq->cmd_type = REQ_TYPE_SPECIAL;
rq->cmd_flags = REQ_QUIET;
ret = blk_execute_rq(drive->queue, cd->disk, rq, 0);
--
1.7.7
next prev parent reply other threads:[~2012-08-09 13:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-09 13:55 [PATCH 03/13] ide: Potential null pointer dereference in ide_queue_pc_tail() Marina Makienko
2012-08-09 13:55 ` Marina Makienko [this message]
2012-08-09 13:55 ` [PATCH 05/13] ide: Potential null pointer dereference in ide_raw_taskfile() Marina Makienko
2012-08-09 13:55 ` [PATCH 06/13] ide: Potential null pointer dereference in generic_ide_resume() Marina Makienko
2012-08-09 13:55 ` [PATCH 07/13] ide: Potential null pointer dereference in ide_cmd_ioctl() Marina Makienko
2012-08-09 13:55 ` [PATCH 08/13] ide: Potential null pointer dereference in ide_devset_execute() Marina Makienko
2012-08-09 13:55 ` [PATCH 09/13] ide: Potential null pointer dereference in set_multcount() Marina Makienko
2012-08-09 13:55 ` [PATCH 10/13] ide: Potential null pointer dereference in ide_cd_queue_pc() Marina Makienko
2012-08-09 13:55 ` [PATCH 11/13] ide: Potential null pointer dereference in idetape_queue_rw_tail() Marina Makienko
2012-08-09 13:55 ` [PATCH 12/13] ide: Potential null pointer dereference in issue_park_cmd() Marina Makienko
2012-08-09 14:13 ` [PATCH 03/13] ide: Potential null pointer dereference in ide_queue_pc_tail() Alan Cox
2012-08-09 21:49 ` David Miller
2012-08-17 17:00 ` Sergei Shtylyov
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=1344520529-19164-2-git-send-email-makienko@ispras.ru \
--to=makienko@ispras.ru \
--cc=davem@davemloft.net \
--cc=ldv-project@ispras.ru \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®