All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/13] ide: Potential null pointer dereference in ide_queue_pc_tail()
@ 2012-08-09 13:55 Marina Makienko
  2012-08-09 13:55 ` [PATCH 04/13] ide: Potential null pointer dereference in ide_cdrom_reset() Marina Makienko
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Marina Makienko @ 2012-08-09 13:55 UTC (permalink / raw)
  To: David S. Miller; +Cc: Marina Makienko, linux-ide, linux-kernel, ldv-project

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-atapi.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index fac3d9d..8bf4109 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -93,6 +93,12 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
 	int error;
 
 	rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
+
+	if (!rq) {
+		printk(KERN_ERR PFX"ide_queue_pc_tail: blk_get_request() failed. \n");
+		return 1;
+	}
+
 	rq->cmd_type = REQ_TYPE_SPECIAL;
 	rq->special = (char *)pc;
 
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-08-17 17:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 04/13] ide: Potential null pointer dereference in ide_cdrom_reset() Marina Makienko
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.