Commit 0010b79d authored by Salym Senyonga's avatar Salym Senyonga Committed by Greg Kroah-Hartman

Staging: ozwpan: Fix null dereference

If net_dev is NULL memcpy() will Oops.
Signed-off-by: default avatarSalym Senyonga <salymsash@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8360fb0d
...@@ -668,8 +668,8 @@ void oz_binding_add(const char *net_dev) ...@@ -668,8 +668,8 @@ void oz_binding_add(const char *net_dev)
if (binding) { if (binding) {
binding->ptype.type = __constant_htons(OZ_ETHERTYPE); binding->ptype.type = __constant_htons(OZ_ETHERTYPE);
binding->ptype.func = oz_pkt_recv; binding->ptype.func = oz_pkt_recv;
memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN);
if (net_dev && *net_dev) { if (net_dev && *net_dev) {
memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN);
oz_dbg(ON, "Adding binding: %s\n", net_dev); oz_dbg(ON, "Adding binding: %s\n", net_dev);
binding->ptype.dev = binding->ptype.dev =
dev_get_by_name(&init_net, net_dev); dev_get_by_name(&init_net, net_dev);
...@@ -680,6 +680,7 @@ void oz_binding_add(const char *net_dev) ...@@ -680,6 +680,7 @@ void oz_binding_add(const char *net_dev)
} }
} else { } else {
oz_dbg(ON, "Binding to all netcards\n"); oz_dbg(ON, "Binding to all netcards\n");
memset(binding->name, 0, OZ_MAX_BINDING_LEN);
binding->ptype.dev = NULL; binding->ptype.dev = NULL;
} }
if (binding) { if (binding) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment