diff options
Diffstat (limited to 'drivers/cdrom/cdrom.c')
-rw-r--r-- | drivers/cdrom/cdrom.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index beaa561f2ed8..153960348414 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -2097,6 +2097,10 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2097 | if (!q) | 2097 | if (!q) |
2098 | return -ENXIO; | 2098 | return -ENXIO; |
2099 | 2099 | ||
2100 | rq = blk_get_request(q, READ, GFP_KERNEL); | ||
2101 | if (!rq) | ||
2102 | return -ENOMEM; | ||
2103 | |||
2100 | cdi->last_sense = 0; | 2104 | cdi->last_sense = 0; |
2101 | 2105 | ||
2102 | while (nframes) { | 2106 | while (nframes) { |
@@ -2108,9 +2112,9 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2108 | 2112 | ||
2109 | len = nr * CD_FRAMESIZE_RAW; | 2113 | len = nr * CD_FRAMESIZE_RAW; |
2110 | 2114 | ||
2111 | rq = blk_rq_map_user(q, READ, ubuf, len); | 2115 | ret = blk_rq_map_user(q, rq, ubuf, len); |
2112 | if (IS_ERR(rq)) | 2116 | if (ret) |
2113 | return PTR_ERR(rq); | 2117 | break; |
2114 | 2118 | ||
2115 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 2119 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
2116 | rq->cmd[0] = GPCMD_READ_CD; | 2120 | rq->cmd[0] = GPCMD_READ_CD; |
@@ -2132,13 +2136,13 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2132 | if (rq->bio) | 2136 | if (rq->bio) |
2133 | blk_queue_bounce(q, &rq->bio); | 2137 | blk_queue_bounce(q, &rq->bio); |
2134 | 2138 | ||
2135 | if (blk_execute_rq(q, cdi->disk, rq)) { | 2139 | if (blk_execute_rq(q, cdi->disk, rq, 0)) { |
2136 | struct request_sense *s = rq->sense; | 2140 | struct request_sense *s = rq->sense; |
2137 | ret = -EIO; | 2141 | ret = -EIO; |
2138 | cdi->last_sense = s->sense_key; | 2142 | cdi->last_sense = s->sense_key; |
2139 | } | 2143 | } |
2140 | 2144 | ||
2141 | if (blk_rq_unmap_user(rq, bio, len)) | 2145 | if (blk_rq_unmap_user(bio, len)) |
2142 | ret = -EFAULT; | 2146 | ret = -EFAULT; |
2143 | 2147 | ||
2144 | if (ret) | 2148 | if (ret) |
@@ -2149,6 +2153,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2149 | ubuf += len; | 2153 | ubuf += len; |
2150 | } | 2154 | } |
2151 | 2155 | ||
2156 | blk_put_request(rq); | ||
2152 | return ret; | 2157 | return ret; |
2153 | } | 2158 | } |
2154 | 2159 | ||