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
| ||
|
Date: Sat, 2 Feb 2013 17:25:24 -0800 From: Tejun Heo <tj@...nel.org> To: akpm@...ux-foundation.org Cc: linux-kernel@...r.kernel.org, rusty@...tcorp.com.au, bfields@...ldses.org, skinsbursky@...allels.com, ebiederm@...ssion.com, jmorris@...ei.org, axboe@...nel.dk, Jason Wang <jasowang@...hat.com>, "Michael S. Tsirkin" <mst@...hat.com> Subject: [PATCH UPDATED 38/62] macvtap: convert to idr_alloc() Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo <tj@...nel.org> Cc: Jason Wang <jasowang@...hat.com> Cc: Michael S. Tsirkin <mst@...hat.com> --- Went out with the wrong subject. This is the same patch with the correct subject. Thanks. This patch depends on an earlier idr changes and I think it would be best to route these together through -mm. Please holler if there's any objection. Thanks. drivers/net/macvtap.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 0f0f9ce..2497f6f 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -279,28 +279,17 @@ static int macvtap_receive(struct sk_buff *skb) static int macvtap_get_minor(struct macvlan_dev *vlan) { int retval = -ENOMEM; - int id; mutex_lock(&minor_lock); - if (idr_pre_get(&minor_idr, GFP_KERNEL) == 0) - goto exit; - - retval = idr_get_new_above(&minor_idr, vlan, 1, &id); - if (retval < 0) { - if (retval == -EAGAIN) - retval = -ENOMEM; - goto exit; - } - if (id < MACVTAP_NUM_DEVS) { - vlan->minor = id; - } else { + retval = idr_alloc(&minor_idr, vlan, 1, MACVTAP_NUM_DEVS, GFP_KERNEL); + if (retval >= 0) { + vlan->minor = retval; + } else if (retval == -ENOSPC) { printk(KERN_ERR "too many macvtap devices\n"); retval = -EINVAL; - idr_remove(&minor_idr, id); } -exit: mutex_unlock(&minor_lock); - return retval; + return retval < 0 ? retval : 0; } static void macvtap_free_minor(struct macvlan_dev *vlan) -- 1.8.1 -- 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