Commit 7baeb6a5 authored by Peter Osterlund's avatar Peter Osterlund Committed by Linus Torvalds

[PATCH] 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.
Signed-off-by: default avatarPeter Osterlund <petero2@telia.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d0856009
...@@ -914,9 +914,11 @@ static int pkt_handle_queue(struct pktcdvd_device *pd) ...@@ -914,9 +914,11 @@ static int pkt_handle_queue(struct pktcdvd_device *pd)
bio = node->bio; bio = node->bio;
zone = ZONE(bio->bi_sector, pd); zone = ZONE(bio->bi_sector, pd);
list_for_each_entry(p, &pd->cdrw.pkt_active_list, list) { 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; goto try_next_bio;
} }
}
break; break;
try_next_bio: try_next_bio:
node = pkt_rbtree_next(node); node = pkt_rbtree_next(node);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment