net/hyperv: fix possible memory leak in do_set_multicast()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Tue, 24 Jan 2012 10:21:28 +0000 (10:21 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Jan 2012 20:47:47 +0000 (15:47 -0500)
do_set_multicast() may not free the memory malloc in
netvsc_set_multicast_list().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc_drv.c

index 462d05f05e84d85d558f036a58b3786768514b03..1a1ca6cfc74aada9edf64b494cefa743b95276ae 100644 (file)
@@ -68,11 +68,11 @@ static void do_set_multicast(struct work_struct *w)
 
        nvdev = hv_get_drvdata(ndevctx->device_ctx);
        if (nvdev == NULL)
-               return;
+               goto out;
 
        rdev = nvdev->extension;
        if (rdev == NULL)
-               return;
+               goto out;
 
        if (net->flags & IFF_PROMISC)
                rndis_filter_set_packet_filter(rdev,
@@ -83,6 +83,7 @@ static void do_set_multicast(struct work_struct *w)
                        NDIS_PACKET_TYPE_ALL_MULTICAST |
                        NDIS_PACKET_TYPE_DIRECTED);
 
+out:
        kfree(w);
 }