staging: unisys: neglect to NULL rcvbuf pointer
authorTim Sell <Timothy.Sell@unisys.com>
Thu, 9 Jul 2015 17:27:45 +0000 (13:27 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jul 2015 01:34:58 +0000 (18:34 -0700)
Neglect to NULL rcvbuf pointer array could result in faults later

This problem would exhibit itself as a fault when when attempting to stop
any visornic device (i.e., in visornic_disable_with_timeout() or
visornic_serverdown_complete()) that had never been started (i.e., for
which init_rcv_bufs() had never been called).  Because the array of rcvbuf
was never cleared to NULLs, we would mistakenly attempt to call kfree_skb()
on garbage memory.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visornic/visornic_main.c

index 72253a07c255d02006bf3e1f242d5764291a3f7f..915c9132a5c4f113ff4a4a9801eb030d9fbc8d04 100644 (file)
@@ -1845,7 +1845,7 @@ static int visornic_probe(struct visor_device *dev)
        if (err)
                goto cleanup_netdev;
 
-       devdata->rcvbuf = kmalloc(sizeof(struct sk_buff *) *
+       devdata->rcvbuf = kzalloc(sizeof(struct sk_buff *) *
                                  devdata->num_rcv_bufs, GFP_KERNEL);
        if (!devdata->rcvbuf) {
                err = -ENOMEM;