When the lirc drivers were converted over to using memdup_user, I mistakenly also removed corresponding calls to kfree. Add those back. I also screwed up on the allocation error check in lirc_serial, using if (PTR_ERR()) instead of if (IS_ERR()), which broke transmit.
Showing the changes to drivers/staging/lirc/lirc_serial.c (1 of 6 files). Show all
Unified · Split
| @@ -966,7 +966,7 @@ static ssize_t lirc_write(struct file *file, const char *buf, · 965 unmodified lines | ||
| 966 | 966 | if (n % sizeof(int) || count % 2 == 0) |
| 967 | 967 | return -EINVAL; |
| 968 | 968 | wbuf = memdup_user(buf, n); |
| 969 | − if (PTR_ERR(wbuf)) | |
| 969 | + if (IS_ERR(wbuf)) | |
| 970 | 970 | return PTR_ERR(wbuf); |
| 971 | 971 | spin_lock_irqsave(&hardware[type].lock, flags); |
| 972 | 972 | if (type == LIRC_IRDEO) { |
| @@ -981,6 +981,7 @@ static ssize_t lirc_write(struct file *file, const char *buf, · 8 unmodified lines | ||
| 981 | 981 | } |
| 982 | 982 | off(); |
| 983 | 983 | spin_unlock_irqrestore(&hardware[type].lock, flags); |
| 984 | + kfree(wbuf); | |
| 984 | 985 | return n; |
| 985 | 986 | } |
| 986 | 987 | |