mirror of
https://github.com/torvalds/linux.git
synced 2024-11-07 12:41:55 +00:00
Staging: ozwpan: Fix null dereference
If net_dev is NULL memcpy() will Oops. Signed-off-by: Salym Senyonga <salymsash@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8360fb0d9c
commit
0010b79d56
@ -668,8 +668,8 @@ void oz_binding_add(const char *net_dev)
|
||||
if (binding) {
|
||||
binding->ptype.type = __constant_htons(OZ_ETHERTYPE);
|
||||
binding->ptype.func = oz_pkt_recv;
|
||||
memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN);
|
||||
if (net_dev && *net_dev) {
|
||||
memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN);
|
||||
oz_dbg(ON, "Adding binding: %s\n", net_dev);
|
||||
binding->ptype.dev =
|
||||
dev_get_by_name(&init_net, net_dev);
|
||||
@ -680,6 +680,7 @@ void oz_binding_add(const char *net_dev)
|
||||
}
|
||||
} else {
|
||||
oz_dbg(ON, "Binding to all netcards\n");
|
||||
memset(binding->name, 0, OZ_MAX_BINDING_LEN);
|
||||
binding->ptype.dev = NULL;
|
||||
}
|
||||
if (binding) {
|
||||
|
Loading…
Reference in New Issue
Block a user