dahdi: Bug fix for enabling buffer events

Introduced in rev 9905, this bug could cause buffer events to become
disabled if the kernel was unable to access userland data.


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9907 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Kinsey Moore 2011-04-15 18:42:16 +00:00
parent e591241187
commit fcd4db20d1

View File

@ -6279,7 +6279,9 @@ static int dahdi_chan_ioctl(struct file *file, unsigned int cmd, unsigned long d
break; break;
#endif #endif
case DAHDI_BUFFER_EVENTS: case DAHDI_BUFFER_EVENTS:
if (get_user(j, (int __user *)data) != -EFAULT && j) if (get_user(j, (int __user *)data))
return -EFAULT;
if (j)
set_bit(DAHDI_FLAGBIT_BUFEVENTS, &chan->flags); set_bit(DAHDI_FLAGBIT_BUFEVENTS, &chan->flags);
else else
clear_bit(DAHDI_FLAGBIT_BUFEVENTS, &chan->flags); clear_bit(DAHDI_FLAGBIT_BUFEVENTS, &chan->flags);