Skip to contentSkip to conversation

qdio: add check index of input- and output_qs[]

PATCH Heiko Carstens 1 participant 1 message Jun 15, 2009 1 message not in the archive s390

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 13 lines · Roel Kluin

Ensure that q_nr is within the bounds of array irq_ptr->input_qs[] and ->output_qs[].

---
I didn't notice this when writing my previous patch. Should bufnr and count be larger than 0 as well?

drivers/s390/cio/qdio_main.c +0 -0
index d79cf5b..9dbc4b1 100644

drivers/s390/cio/qdio_main.c int do_QDIO(struct ccw_device *cdev, unsigned int callflags, · line 1498

Quoted 6 lines
drivers/s390/cio/qdio_main.c +1 -1
@@ -1494,7 +1494,7 @@ int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
 
 	if ((bufnr > QDIO_MAX_BUFFERS_PER_Q) ||
 	    (count > QDIO_MAX_BUFFERS_PER_Q) ||
-	    (q_nr >= QDIO_MAX_QUEUES_PER_IRQ))
+	    (q_nr >= QDIO_MAX_QUEUES_PER_IRQ) || (q_nr < 0))
 		return -EINVAL;

These are just sanity checks. I'd rather prefer to see all of them go away or have them under an #ifdef DEBUG.
But it's Jan's call. He is the maintainer of the driver.