Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187135
b: refs/heads/master
c: 4575b55
h: refs/heads/master
i:
  187133: f292f5b
  187131: 6d78083
  187127: 7f4d5e3
  187119: 5bac354
  187103: 046112c
  187071: dcf62c0
  187007: 1e27aab
  186879: a1f85e1
v: v3
  • Loading branch information
Joe Perches authored and Linus Torvalds committed Mar 12, 2010
1 parent 72bc9dd commit 4abfb74
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e029853612ba5999caed4dbc833dab729aac75ba
refs/heads/master: 4575b55281825d157573bbc5aa28b9144193ddd2
51 changes: 35 additions & 16 deletions trunk/drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3151,8 +3151,10 @@ static inline int raw_cmd_copyout(int cmd, char __user *param,
if (ptr->length >= 0 &&
ptr->length <= ptr->buffer_length) {
long length = ptr->buffer_length - ptr->length;
ECALL(fd_copyout(ptr->data, ptr->kernel_data,
length));
ret = fd_copyout(ptr->data, ptr->kernel_data,
length);
if (ret)
return ret;
}
}
ptr = ptr->next;
Expand Down Expand Up @@ -3223,9 +3225,12 @@ static inline int raw_cmd_copyin(int cmd, char __user *param,
return -ENOMEM;
ptr->buffer_length = ptr->length;
}
if (ptr->flags & FD_RAW_WRITE)
ECALL(fd_copyin(ptr->data, ptr->kernel_data,
ptr->length));
if (ptr->flags & FD_RAW_WRITE) {
ret = fd_copyin(ptr->data, ptr->kernel_data,
ptr->length);
if (ret)
return ret;
}
rcmd = &(ptr->next);
if (!(ptr->flags & FD_RAW_MORE))
return 0;
Expand Down Expand Up @@ -3329,10 +3334,12 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,

if (lock_fdc(drive, 1))
return -EINTR;
if (cmd != FDDEFPRM)
if (cmd != FDDEFPRM) {
/* notice a disk change immediately, else
* we lose our settings immediately*/
CALL(poll_drive(1, FD_RAW_NEED_DISK));
if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR)
return -EINTR;
}
oldStretch = g->stretch;
user_params[drive] = *g;
if (buffer_drive == drive)
Expand Down Expand Up @@ -3413,7 +3420,8 @@ static int get_floppy_geometry(int drive, int type, struct floppy_struct **g)
else {
if (lock_fdc(drive, 0))
return -EINTR;
CALL(poll_drive(0, 0));
if (poll_drive(0, 0) == -EINTR)
return -EINTR;
process_fd_request();
*g = current_type[drive];
}
Expand Down Expand Up @@ -3471,7 +3479,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
return -EINVAL;

/* convert the old style command into a new style command */
ECALL(normalize_ioctl(&cmd, &size));
ret = normalize_ioctl(&cmd, &size);
if (ret)
return ret;

/* permission checks */
if (((cmd & 0x40) && !FD_IOCTL_ALLOWED) ||
Expand All @@ -3483,8 +3493,11 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,

/* copyin */
memset(&inparam, 0, sizeof(inparam));
if (_IOC_DIR(cmd) & _IOC_WRITE)
ECALL(fd_copyin((void __user *)param, &inparam, size));
if (_IOC_DIR(cmd) & _IOC_WRITE) {
ret = fd_copyin((void __user *)param, &inparam, size);
if (ret)
return ret;
}

switch (cmd) {
case FDEJECT:
Expand Down Expand Up @@ -3513,9 +3526,11 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
case FDDEFPRM:
return set_geometry(cmd, &inparam.g, drive, type, bdev);
case FDGETPRM:
ECALL(get_floppy_geometry(drive, type,
ret = get_floppy_geometry(drive, type,
(struct floppy_struct **)
&outparam));
&outparam);
if (ret)
return ret;
break;
case FDMSGON:
UDP->flags |= FTD_MSG;
Expand All @@ -3526,7 +3541,8 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
case FDFMTBEG:
if (lock_fdc(drive, 1))
return -EINTR;
CALL(poll_drive(1, FD_RAW_NEED_DISK));
if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR)
return -EINTR;
ret = UDRS->flags;
process_fd_request();
if (ret & FD_VERIFY)
Expand Down Expand Up @@ -3565,7 +3581,8 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
case FDPOLLDRVSTAT:
if (lock_fdc(drive, 1))
return -EINTR;
CALL(poll_drive(1, FD_RAW_NEED_DISK));
if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR)
return -EINTR;
process_fd_request();
/* fall through */
case FDGETDRVSTAT:
Expand All @@ -3588,7 +3605,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
if (lock_fdc(drive, 1))
return -EINTR;
set_floppy(drive);
CALL(i = raw_cmd_ioctl(cmd, (void __user *)param));
i = raw_cmd_ioctl(cmd, (void __user *)param);
if (i == -EINTR)
return -EINTR;
process_fd_request();
return i;
case FDTWADDLE:
Expand Down

0 comments on commit 4abfb74

Please sign in to comment.