Re: [PATCH v3] Add refcounts to LED target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adam Nielsen <a.nielsen@xxxxxxxxxxx> wrote:
> +static struct xt_led_info_internal *led_trigger_lookup(const char *name)
> +{
> +	struct xt_led_info_internal *ledinternal;
> +
> +	list_for_each_entry(ledinternal, &xt_led_triggers, list) {
> +		if (!strcmp(name, ledinternal->netfilter_led_trigger.name)) {
> +			mutex_unlock(&xt_led_mutex);

This mutex_unlock looks out of place...

>  static int led_tg_check(const struct xt_tgchk_param *par)
>  {
>  	struct xt_led_info *ledinfo = par->targinfo;
> @@ -91,11 +109,26 @@ static int led_tg_check(const struct xt_tgchk_param *par)
>  		return -EINVAL;
>  	}
>  
> +	mutex_lock(&xt_led_mutex);
> +
> +	ledinternal = led_trigger_lookup(ledinfo->id);
> +	if (ledinternal) {
> +		ledinternal->refcnt++;
> +		goto out;

...its unlocked again here via goto.

> +	err = -ENOMEM;
>  	ledinternal = kzalloc(sizeof(struct xt_led_info_internal), GFP_KERNEL);
>  	if (!ledinternal)
> -		return -ENOMEM;
> +		goto exit_mutex_only;
> +
> +	ledinternal->trigger_id = kzalloc(strlen(ledinfo->id) + 1, GFP_KERNEL);

kstrdup()?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux