diff options
author | Roel Kluin <12o3l@tiscali.nl> | 2007-10-30 04:11:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-10-30 04:11:46 -0400 |
commit | e3376dca81bd45474143753339e109d877a7d129 (patch) | |
tree | 4d5eb4eea4a1cd37070ae562e0215dcd49357771 /drivers/net/wan/lmc | |
parent | 521c2a43b2e72dd5c9ab1b1ae7f894ba8a58779d (diff) |
[WAN]: lmc_ioctl: don't return with locks held
(akpm: it's doing copy_to_user() inside spin_lock_irqsave(): this driver
appears to be beyond help).
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan/lmc')
-rw-r--r-- | drivers/net/wan/lmc/lmc_main.c | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index 5ea877221f46..64eb57893602 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -142,9 +142,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
142 | * To date internally, just copy this out to the user. | 142 | * To date internally, just copy this out to the user. |
143 | */ | 143 | */ |
144 | case LMCIOCGINFO: /*fold01*/ | 144 | case LMCIOCGINFO: /*fold01*/ |
145 | if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof (lmc_ctl_t))) | 145 | if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof(lmc_ctl_t))) |
146 | return -EFAULT; | 146 | ret = -EFAULT; |
147 | ret = 0; | 147 | else |
148 | ret = 0; | ||
148 | break; | 149 | break; |
149 | 150 | ||
150 | case LMCIOCSINFO: /*fold01*/ | 151 | case LMCIOCSINFO: /*fold01*/ |
@@ -159,8 +160,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
159 | break; | 160 | break; |
160 | } | 161 | } |
161 | 162 | ||
162 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t))) | 163 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof(lmc_ctl_t))) { |
163 | return -EFAULT; | 164 | ret = -EFAULT; |
165 | break; | ||
166 | } | ||
164 | 167 | ||
165 | sc->lmc_media->set_status (sc, &ctl); | 168 | sc->lmc_media->set_status (sc, &ctl); |
166 | 169 | ||
@@ -190,8 +193,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
190 | break; | 193 | break; |
191 | } | 194 | } |
192 | 195 | ||
193 | if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) | 196 | if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) { |
194 | return -EFAULT; | 197 | ret = -EFAULT; |
198 | break; | ||
199 | } | ||
195 | 200 | ||
196 | 201 | ||
197 | if (new_type == old_type) | 202 | if (new_type == old_type) |
@@ -229,9 +234,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
229 | sc->lmc_xinfo.Magic1 = 0xDEADBEEF; | 234 | sc->lmc_xinfo.Magic1 = 0xDEADBEEF; |
230 | 235 | ||
231 | if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo, | 236 | if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo, |
232 | sizeof (struct lmc_xinfo))) | 237 | sizeof(struct lmc_xinfo))) { |
233 | return -EFAULT; | 238 | ret = -EFAULT; |
234 | ret = 0; | 239 | else |
240 | ret = 0; | ||
235 | 241 | ||
236 | break; | 242 | break; |
237 | 243 | ||
@@ -262,9 +268,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
262 | 268 | ||
263 | if (copy_to_user(ifr->ifr_data, &sc->stats, | 269 | if (copy_to_user(ifr->ifr_data, &sc->stats, |
264 | sizeof (struct lmc_statistics))) | 270 | sizeof (struct lmc_statistics))) |
265 | return -EFAULT; | 271 | ret = -EFAULT; |
266 | 272 | else | |
267 | ret = 0; | 273 | ret = 0; |
268 | break; | 274 | break; |
269 | 275 | ||
270 | case LMCIOCCLEARLMCSTATS: /*fold01*/ | 276 | case LMCIOCCLEARLMCSTATS: /*fold01*/ |
@@ -292,8 +298,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
292 | break; | 298 | break; |
293 | } | 299 | } |
294 | 300 | ||
295 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t))) | 301 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof(lmc_ctl_t))) { |
296 | return -EFAULT; | 302 | ret = -EFAULT; |
303 | break; | ||
304 | } | ||
297 | sc->lmc_media->set_circuit_type(sc, ctl.circuit_type); | 305 | sc->lmc_media->set_circuit_type(sc, ctl.circuit_type); |
298 | sc->ictl.circuit_type = ctl.circuit_type; | 306 | sc->ictl.circuit_type = ctl.circuit_type; |
299 | ret = 0; | 307 | ret = 0; |
@@ -318,12 +326,15 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
318 | 326 | ||
319 | #ifdef DEBUG | 327 | #ifdef DEBUG |
320 | case LMCIOCDUMPEVENTLOG: | 328 | case LMCIOCDUMPEVENTLOG: |
321 | if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof (u32))) | 329 | if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof(u32))) { |
322 | return -EFAULT; | 330 | ret = -EFAULT; |
331 | break; | ||
332 | } | ||
323 | if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf))) | 333 | if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf))) |
324 | return -EFAULT; | 334 | ret = -EFAULT; |
335 | else | ||
336 | ret = 0; | ||
325 | 337 | ||
326 | ret = 0; | ||
327 | break; | 338 | break; |
328 | #endif /* end ifdef _DBG_EVENTLOG */ | 339 | #endif /* end ifdef _DBG_EVENTLOG */ |
329 | case LMCIOCT1CONTROL: /*fold01*/ | 340 | case LMCIOCT1CONTROL: /*fold01*/ |
@@ -346,8 +357,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
346 | */ | 357 | */ |
347 | netif_stop_queue(dev); | 358 | netif_stop_queue(dev); |
348 | 359 | ||
349 | if (copy_from_user(&xc, ifr->ifr_data, sizeof (struct lmc_xilinx_control))) | 360 | if (copy_from_user(&xc, ifr->ifr_data, sizeof(struct lmc_xilinx_control))) { |
350 | return -EFAULT; | 361 | ret = -EFAULT; |
362 | break; | ||
363 | } | ||
351 | switch(xc.command){ | 364 | switch(xc.command){ |
352 | case lmc_xilinx_reset: /*fold02*/ | 365 | case lmc_xilinx_reset: /*fold02*/ |
353 | { | 366 | { |