Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Commit [887e63] Maximize Restore History

[media] lirc_dev: fixes in lirc_dev_fop_read()

Backport from upstream kernel:

commit 250f7a5f62a08985af5cf7728ae7ba9edbfdc0a9
Author: Dan Carpenter <error27@gmail.com>
Date: Wed Nov 17 02:20:15 2010 -0300

[media] lirc_dev: fixes in lirc_dev_fop_read()

This makes several changes but they're in one function and sort of
related:

"buf" was leaked on error. The leak if we try to read an invalid
length is the main concern because it could be triggered over and
over.

If the copy_to_user() failed, then the original code returned the
number of bytes remaining. read() is supposed to be the opposite way,
where we return the number of bytes copied. I changed it to just return
-EFAULT on errors.

Also I changed the debug output from "-EFAULT" to just "<fail>" because
it isn't -EFAULT necessarily. And since we go though that path if the
length is invalid now, there was another debug print that I removed.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Signed-off-by: Jarod Wilson <jarod@redhat.com>

Jarod Wilson Jarod Wilson 2012-02-07

changed drivers/lirc_dev/lirc_dev.c
drivers/lirc_dev/lirc_dev.c Diff Switch to side-by-side view
Loading...