|
From: Gordon M. <gm...@us...> - 2001-04-19 00:22:12
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.169 1.170=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
--Fixed a few formatting things and return values
--Fixed a kernel hang that occured with the following sequence of events:
1. insmod bt.o
2. start an app to setup the stack over a tty
3. establish an SDP connection
4. terminate the app that setup the stack without doing a BTSHUTDOWN -- t=
his is the problem, because sertty now points to an invalid tty once the ap=
p exits, and tty_bt_close was not setting sertty to NULL.
5. rmmod bt.o -- this tries to shutdown the SDP connection, but sertty->d=
river.write is no longer a valid operation.
Fixed the problem by setting sertty to NULL in bt_tty_close. Now bt_write=
_lower_driver just drops the SDP disconnection request on rmmod and things =
appear to clean up ok.
=20=20
The diff of the modified file(s):
--- bluetooth.c 2001/04/18 15:23:09 1.169
+++ bluetooth.c 2001/04/19 00:22:11 1.170
@@ -1261,6 +1261,8 @@
}
line++;
}
+
+ sertty =3D NULL;
}
=20
/*
@@ -1759,17 +1761,19 @@
=20
/* SDP connection not active! Don't issue the request */
=20
- BT_DRIVER("bt_execute_sdp_request: line %d does not have an active conne=
ction!\n", line);
- return -1;
+ BT_DRIVER(__FUNCTION__": line %d does not have an active "\
+ "connection!\n", line);
+ return -ENOTCONN;
}
=20
BT_DRIVER("bt_execute_sdp_request: line %d SDP index %d\n",
line, sdpIndex);
+
if (sdpStartRequest(sdpIndex,
sdpRequest->sdpCommand,
sdpRequest->pduPayload,
sdpRequest->pduLength) < 0)
- return -1;
+ return -1; /* fixme -- EPERM probably not appropriate */
=20
/* Sleep on this line while the response is going through */
=20
@@ -1780,11 +1784,17 @@
Copy into sdpRequest and return */
=20=09
if (bt_ctrl.session[line].sdpRequestResponseData) {
- BT_DRIVER("bt_execute_sdp_request: sdpRequestResponseData 0x%x - copying=
\n", (int)bt_ctrl.session[line].sdpRequestResponseData);
+
+ BT_DRIVER(__FUNCTION__": sdpRequestResponseData 0x%x"\
+ "- copying\n",=20
+ (int)bt_ctrl.session[line].sdpRequestResponseData);
+
memcpy(sdpRequest->requestResponse,
bt_ctrl.session[line].sdpRequestResponseData,=20
bt_ctrl.session[line].sdpRequestResponseDataLength);
- sdpRequest->responseLength =3D bt_ctrl.session[line].sdpRequestResponseD=
ataLength;
+ sdpRequest->responseLength =3D=20
+ bt_ctrl.session[line].sdpRequestResponseDataLength;
+
}
=20
return 0;
@@ -1871,11 +1881,12 @@
/* When data received for this line, we simply attach the
data (& length) and wake up */
=20=09
- BT_DRIVER("bt_send_sdp_data_received: data 0x%x len %d\n", (int)data, len=
);
+ BT_DRIVER(__FUNCTION__": data 0x%x len %d\n", (int)data, len);
/* If previous data, deallocate it */
=20
if (bt_ctrl.session[line].sdpRequestResponseData) {
- D_WARN("bt_send_sdp_data_received: sdpRequestResponseData set - dealloca=
te\n");
+ D_WARN(__FUNCTION__": sdpRequestResponseData set - "\
+ "deallocate\n");
kfree(bt_ctrl.session[line].sdpRequestResponseData);
bt_ctrl.session[line].sdpRequestResponseData =3D NULL;
bt_ctrl.session[line].sdpRequestResponseDataLength =3D 0;
@@ -2450,8 +2461,6 @@
{
s32 found =3D 0;
=20
- printk(__FUNCTION__ ": line =3D %d (gjm)\n", line);
-
if (!bt_stack_initiated) {
D_WARN("bt_register_sdp : Bluetooth stack not initialized\n");
return -1;=09
@@ -2745,7 +2754,6 @@
=20
save_flags(flags);
cli();
-
if ((error =3D tty_unregister_driver(&bt_driver)))
printk("SERIAL: failed to unregister bluetooth driver (%d)\n",
error);
|