Skip to contentSkip to conversation

CDRW/DVD packet writing data corruption fix

PATCH New Peter Osterlund 1 participant 1 message May 15, 2005 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CDRW/DVD packet writing data corruption fix

I found a bug in the packet writing driver that could cause data corruption. The problem arised if the driver got a write request for a sector in a "zone" it was already working on. In that case it was supposed to queue the write request until it was done processing earlier requests for the same zone, and instead work on some other zone in the mean time. However, if there was no other zone to work on, the driver would initiate two packet_data objects for the same zone, causing unpredictable things to happen.

I haven't tested this as much as I want yet, so I don't know if there are more data corruption bugs in the driver. Test reports would be appreciated.

---

 linux-petero/drivers/block/pktcdvd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)
drivers/block/pktcdvd.c renamed from drivers/block/pktcdvd.c~packet-corruption-fix +3 -1
diff -puN drivers/block/pktcdvd.c~packet-corruption-fix drivers/block/pktcdvd.c
@@ -926,8 +926,10 @@ static int pkt_handle_queue(struct pktcd
 		bio = node->bio;
 		zone = ZONE(bio->bi_sector, pd);
 		list_for_each_entry(p, &pd->cdrw.pkt_active_list, list) {
-			if (p->sector == zone)
+			if (p->sector == zone) {
+				bio = NULL;
 				goto try_next_bio;
+			}
 		}
 		break;
 try_next_bio:

_

Signature · 2 lines
Peter Osterlund - [email protected]
http://web.telia.com/~u89404340