From: Peter Osterlund Date: Tue, 17 May 2005 04:53:42 +0000 (-0700) Subject: [PATCH] CDRW/DVD packet writing data corruption fix X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7baeb6a5ccab2d472679a053e64a63ac423c3a42;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [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: Peter Osterlund Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 82ccad0a7f1a..b9a6b7ad64f3 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -914,8 +914,10 @@ static int pkt_handle_queue(struct pktcdvd_device *pd) 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: