From: Peter Osterlund Date: Tue, 14 Feb 2006 21:52:56 +0000 (-0800) Subject: [PATCH] pktcdvd: Don't unlock the door if the disc is in use X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=948423e5ccc33bc257384ad4b339214c577bc926;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [PATCH] pktcdvd: Don't unlock the door if the disc is in use Unlocking the door when the disc is in use is obviously not good, because then it's possible to eject the disc at the wrong time and cause severe disc data corruption. 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 edf6bf29002e..89d8fe014efa 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -2435,7 +2435,8 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u * The door gets locked when the device is opened, so we * have to unlock it or else the eject command fails. */ - pkt_lock_door(pd, 0); + if (pd->refcnt == 1) + pkt_lock_door(pd, 0); return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); default: