From: Borislav Petkov <petkovbb@googlemail.com>
To: Alexander Inyukhin <shurick@sectorb.msk.ru>
Cc: linux-ide@vger.kernel.org, Tejun Heo <tj@kernel.org>,
Jens Axboe <jens.axboe@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: Re: [patch] cdrom: Handle TOC
Date: Thu, 7 Aug 2008 06:18:37 +0200 [thread overview]
Message-ID: <20080807041837.GA2394@gollum.tnic> (raw)
In-Reply-To: <20080806210358.GA7386@shurick.s2s.msu.ru>
On Thu, Aug 07, 2008 at 01:03:58AM +0400, Alexander Inyukhin wrote:
> Hi
>
> This patch should fix TOC handling for cdroms that can not play audio.
> It extends commit af744e3294d09d706c4eae26cffaaa68a8d40337
> with a safety check and non-audio ioctls support.
>
> Since CDC_PLAY_AUDIO flag was used not only to check ability
> to play audio but also to ensure that audio_ioctl was not NULL,
> all TOC-related operations had to use it.
>
> As far as I understand, now audio_ioctl is never NULL,
> so a sanity check during device registration should be sufficient.
>
> The patch is against 2.6.27-rc2. It was tested on Optiarc AD7203A
> device, that has no ability to play audio.
> diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
> index d9d1b65..efc3aa0 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -394,6 +394,8 @@ int register_cdrom(struct cdrom_device_info *cdi)
>
> if (cdo->open == NULL || cdo->release == NULL)
> return -EINVAL;
> + if (cdo->audio_ioctl == NULL)
> + return -EINVAL;
How about putting all checks above together:
if (!cdo->open || !cdo->release || !cdo->audio_ioctl)
return -EINVAL;
?
> if (!banner_printed) {
> printk(KERN_INFO "Uniform CD-ROM driver " REVISION "\n");
> banner_printed = 1;
> @@ -408,7 +410,6 @@ int register_cdrom(struct cdrom_device_info *cdi)
> ENSURE(get_last_session, CDC_MULTI_SESSION);
> ENSURE(get_mcn, CDC_MCN);
> ENSURE(reset, CDC_RESET);
> - ENSURE(audio_ioctl, CDC_PLAY_AUDIO);
> ENSURE(generic_packet, CDC_GENERIC_PACKET);
> cdi->mc_flags = 0;
> cdo->n_minors = 0;
> @@ -2506,8 +2507,6 @@ static int cdrom_ioctl_get_subchnl(struct cdrom_device_info *cdi,
>
> /* cdinfo(CD_DO_IOCTL,"entering CDROMSUBCHNL\n");*/
>
> - if (!CDROM_CAN(CDC_PLAY_AUDIO))
> - return -ENOSYS;
> if (copy_from_user(&q, argp, sizeof(q)))
> return -EFAULT;
>
> @@ -2538,8 +2537,6 @@ static int cdrom_ioctl_read_tochdr(struct cdrom_device_info *cdi,
>
> /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCHDR\n"); */
>
> - if (!CDROM_CAN(CDC_PLAY_AUDIO))
> - return -ENOSYS;
> if (copy_from_user(&header, argp, sizeof(header)))
> return -EFAULT;
>
> @@ -2562,8 +2559,6 @@ static int cdrom_ioctl_read_tocentry(struct cdrom_device_info *cdi,
>
> /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCENTRY\n"); */
>
> - if (!CDROM_CAN(CDC_PLAY_AUDIO))
> - return -ENOSYS;
> if (copy_from_user(&entry, argp, sizeof(entry)))
> return -EFAULT;
>
--
Regards/Gruss,
Boris.
next prev parent reply other threads:[~2008-08-07 4:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 21:03 [patch] cdrom: Handle TOC Alexander Inyukhin
2008-08-06 23:11 ` Tejun Heo
2008-08-07 4:23 ` Borislav Petkov
2008-08-07 4:18 ` Borislav Petkov [this message]
2008-08-07 17:11 ` Alexander Inyukhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080807041837.GA2394@gollum.tnic \
--to=petkovbb@googlemail.com \
--cc=akpm@linux-foundation.org \
--cc=bzolnier@gmail.com \
--cc=jens.axboe@oracle.com \
--cc=linux-ide@vger.kernel.org \
--cc=petkovbb@gmail.com \
--cc=shurick@sectorb.msk.ru \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox