From nobody Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Sat, 24 Jun 2006 09:44:18 -0400 Subject: [PATCH] [UBUNTU: cdrom] Fix cdrom open Some time ago the cdrom open routine was changed so that we call the driver's open routine before checking to see if it is read only. However, if we discovered that a read write open was not possible and the open flags required a writable open, we just returned -EROFS without calling the driver's release routine. This seems to work for most cdrom drivers, but breaks the Powerpc iSeries virtual cdrom rather badly. This just inserts the release call in the error path to balance the call to "->open()" done by "open_for_data()". Stolen from 2.6.17 Signed-off-by: Chuck Short --- drivers/cdrom/cdrom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) 2ea4ea42c3891df70b6e90b3954464ec503d177c diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 1539603..003b917 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -1010,9 +1010,9 @@ int cdrom_open(struct cdrom_device_info if (fp->f_mode & FMODE_WRITE) { ret = -EROFS; if (cdrom_open_write(cdi)) - goto err; + goto err_release; if (!CDROM_CAN(CDC_RAM)) - goto err; + goto err_release; ret = 0; cdi->media_written = 0; } @@ -1027,6 +1027,8 @@ int cdrom_open(struct cdrom_device_info not be mounting, but opening with O_NONBLOCK */ check_disk_change(ip->i_bdev); return 0; +err_release: + cdi->ops->release(cdi); err: cdi->use_count--; return ret; -- 1.3.3