[SRU Oneiric/Precise][Quantal][PATCH] [media] Avoid sysfs oops when an rc_dev's raw device is absent

Herton Ronaldo Krzesinski herton.krzesinski at canonical.com
Tue Aug 7 13:47:02 UTC 2012


On Mon, Aug 06, 2012 at 02:06:48PM -0300, Herton Ronaldo Krzesinski wrote:
> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index 6e16b09..cabc19c 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -775,10 +775,11 @@ static ssize_t show_protocols(struct device *device,
>  	if (dev->driver_type == RC_DRIVER_SCANCODE) {
>  		enabled = dev->rc_map.rc_type;
>  		allowed = dev->allowed_protos;
> -	} else {
> +	} else if (dev->raw) {
>  		enabled = dev->raw->enabled_protocols;
>  		allowed = ir_raw_get_allowed_protocols();
> -	}
> +	} else
> +		return -ENODEV;

This patch has an issue, thanks to Ben Hutchings that pointed it out.
It's missing an mutex_unlock on exit. I'll post shortly an patch to
address, or we can revert and later reapply with the fix that should get
into upstream.

>  
>  	IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
>  		   (long long)allowed,
> -- 
> 1.7.9.5
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
> 

-- 
[]'s
Herton




More information about the kernel-team mailing list