From: Peter Osterlund Date: Mon, 14 Nov 2005 00:06:36 +0000 (-0800) Subject: [PATCH] packet writing oops fix X-Git-Tag: v2.6.14.3~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9761be89f5a057bf2bae57ca98990f89ad5edbe2;p=thirdparty%2Fkernel%2Fstable.git [PATCH] packet writing oops fix There is an old bug in the pkt_count_states() function that causes stack corruption. When compiling with gcc 3.x or 2.x it is harmless, but gcc 4 allocates local variables differently, which makes the bug visible. Signed-off-by: Peter Osterlund Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Wright Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a280e679b1cad..a10ee0266e829 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -1191,7 +1191,7 @@ static void pkt_count_states(struct pktcdvd_device *pd, int *states) struct packet_data *pkt; int i; - for (i = 0; i <= PACKET_NUM_STATES; i++) + for (i = 0; i < PACKET_NUM_STATES; i++) states[i] = 0; spin_lock(&pd->cdrw.active_list_lock);