lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20061203132605.ee8028a5.akpm@osdl.org>
Date:	Sun, 3 Dec 2006 13:26:05 -0800
From:	Andrew Morton <akpm@...l.org>
To:	minyard@....org
Cc:	Linux Kernel <linux-kernel@...r.kernel.org>,
	OpenIPMI Developers <openipmi-developer@...ts.sourceforge.net>,
	Carol Hebert <cah@...ibm.com>
Subject: Re: [Patch 2/12] IPMI: remove interface number limits

On Fri, 1 Dec 2006 22:24:22 -0600
Corey Minyard <minyard@....org> wrote:

> 
> This patch removes the arbitrary limit of number of IPMI interfaces.
> This has been tested with 8 interfaces.
> 
> Signed-off-by: Corey Minyard <minyard@....org>
> Cc: Carol Hebert <cah@...ibm.com>
> 
> ..
>
> +struct watcher_entry {
> +	struct list_head link;
> +	int intf_num;
> +};
> +
>  int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher)
>  {
> -	int           i;
> -	unsigned long flags;
> +	ipmi_smi_t intf;
> +	struct list_head to_deliver = LIST_HEAD_INIT(to_deliver);
> +	struct watcher_entry *e, *e2;
> +
> +	mutex_lock(&ipmi_interfaces_mutex);
> +
> +	list_for_each_entry_rcu(intf, &ipmi_interfaces, link) {
> +		if (intf->intf_num == -1)
> +			continue;
> +		e = kmalloc(sizeof(*e), GFP_KERNEL);
> +		if (!e)
> +			goto out_err;

You miss a mutex_unlock(&ipmi_interfaces_mutex) here

> +		e->intf_num = intf->intf_num;
> +		list_add_tail(&e->link, &to_deliver);
> +	}
>  
>  	down_write(&smi_watchers_sem);
>  	list_add(&(watcher->link), &smi_watchers);
>  	up_write(&smi_watchers_sem);
> -	spin_lock_irqsave(&interfaces_lock, flags);
> -	for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
> -		ipmi_smi_t intf = ipmi_interfaces[i];
> -		if (IPMI_INVALID_INTERFACE(intf))
> -			continue;
> -		spin_unlock_irqrestore(&interfaces_lock, flags);
> -		watcher->new_smi(i, intf->si_dev);
> -		spin_lock_irqsave(&interfaces_lock, flags);
> +
> +	mutex_unlock(&ipmi_interfaces_mutex);
> +
> +	list_for_each_entry_safe(e, e2, &to_deliver, link) {
> +		list_del(&e->link);
> +		watcher->new_smi(e->intf_num, intf->si_dev);
> +		kfree(e);
>  	}
> -	spin_unlock_irqrestore(&interfaces_lock, flags);
> +
> +
>  	return 0;
> +
> + out_err:
> +	list_for_each_entry_safe(e, e2, &to_deliver, link) {
> +		list_del(&e->link);
> +		kfree(e);
> +	}
> +	return -ENOMEM;
>  }
>  
> ...
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ