Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] 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()".

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Jens Axboe and committed by
Linus Torvalds
16070428 553698f9

+4 -2
+4 -2
drivers/cdrom/cdrom.c
··· 1009 1009 if (fp->f_mode & FMODE_WRITE) { 1010 1010 ret = -EROFS; 1011 1011 if (cdrom_open_write(cdi)) 1012 - goto err; 1012 + goto err_release; 1013 1013 if (!CDROM_CAN(CDC_RAM)) 1014 - goto err; 1014 + goto err_release; 1015 1015 ret = 0; 1016 1016 cdi->media_written = 0; 1017 1017 } ··· 1026 1026 not be mounting, but opening with O_NONBLOCK */ 1027 1027 check_disk_change(ip->i_bdev); 1028 1028 return 0; 1029 + err_release: 1030 + cdi->ops->release(cdi); 1029 1031 err: 1030 1032 cdi->use_count--; 1031 1033 return ret;