Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10565
b: refs/heads/master
c: 34abf91
h: refs/heads/master
i:
  10563: 7eacca1
v: v3
  • Loading branch information
Dmitry Torokhov authored and Greg Kroah-Hartman committed Oct 28, 2005
1 parent 7d8f6e6 commit 54c1e86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 17dd3f0f7aa729a042af5d3318ff9b3e7781b45b
refs/heads/master: 34abf91f4036c01669e298e649b7ba85cadf82eb
13 changes: 8 additions & 5 deletions trunk/net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ static int hidp_session(void *arg)

if (session->input) {
input_unregister_device(session->input);
kfree(session->input);
session->input = NULL;
}

up_write(&hidp_session_sem);
Expand All @@ -536,6 +536,8 @@ static inline void hidp_setup_input(struct hidp_session *session, struct hidp_co

input->private = session;

input->name = "Bluetooth HID Boot Protocol Device";

input->id.bustype = BUS_BLUETOOTH;
input->id.vendor = req->vendor;
input->id.product = req->product;
Expand Down Expand Up @@ -582,16 +584,15 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
return -ENOTUNIQ;

session = kmalloc(sizeof(struct hidp_session), GFP_KERNEL);
if (!session)
if (!session)
return -ENOMEM;
memset(session, 0, sizeof(struct hidp_session));

session->input = kmalloc(sizeof(struct input_dev), GFP_KERNEL);
session->input = input_allocate_device();
if (!session->input) {
kfree(session);
return -ENOMEM;
}
memset(session->input, 0, sizeof(struct input_dev));

down_write(&hidp_session_sem);

Expand Down Expand Up @@ -651,8 +652,10 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,

__hidp_unlink_session(session);

if (session->input)
if (session->input) {
input_unregister_device(session->input);
session->input = NULL; /* don't try to free it here */
}

failed:
up_write(&hidp_session_sem);
Expand Down

0 comments on commit 54c1e86

Please sign in to comment.