bluetooth:Fix variable assignment for internal function returns in the function l2cap_bredr_sig_cmd
Subsystems (4)
PATCH 1/1 bluetooth:Fix variable assignment for internal function returns in the function l2cap_bredr_sig_cmd
This makes all internal functions that can return a error code to properly signal this to the caller of the function l2cap_bredr_sig_cmd by making their return value equal to the variable err before returning to the caller of the function l2cap_bredr_sig_cmd with this value as to allow us to correctly signal when a failure has occurred when this particular function is called.
--- net/bluetooth/l2cap_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/bluetooth/l2cap_core.c +4 -4
@@ -5319,7 +5319,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,switch (cmd->code) {case L2CAP_COMMAND_REJ : -l2cap_command_rej (conn, cmd, cmd_len, data); + err =l2cap_command_rej (conn, cmd, cmd_len, data);break ;case L2CAP_CONN_REQ :
@@ -5328,7 +5328,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,case L2CAP_CONN_RSP :case L2CAP_CREATE_CHAN_RSP : -l2cap_connect_create_rsp (conn, cmd, cmd_len, data); + err =l2cap_connect_create_rsp (conn, cmd, cmd_len, data);break ;case L2CAP_CONF_REQ :
@@ -5336,7 +5336,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,break ;case L2CAP_CONF_RSP : -l2cap_config_rsp (conn, cmd, cmd_len, data); + err =l2cap_config_rsp (conn, cmd, cmd_len, data);break ;case L2CAP_DISCONN_REQ :
@@ -5344,7 +5344,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,break ;case L2CAP_DISCONN_RSP : -l2cap_disconnect_rsp (conn, cmd, cmd_len, data); + err =l2cap_disconnect_rsp (conn, cmd, cmd_len, data);break ;case L2CAP_ECHO_REQ :
Signature · 1 line
2.1.4
Marcel Holtmann
maintainerHi Nick,
Quoted 17 lines
This makes all internal functions that can return a error code to properly signal this to the caller of the function
l2cap_bredr_sig_cmdby making their return value equal to the variable err before returning to the caller of the functionl2cap_bredr_sig_cmdwith this value as to allow us to correctly signal when a failure has occurred when this particular function is called.Signed-off-by Nicholas Krause <[email protected]>---
net/bluetooth/l2cap_core.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)net/bluetooth/l2cap_core.c +0
-0
net/bluetooth/l2cap_core.c static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn, · line 5323
Quoted 6 lines
net/bluetooth/l2cap_core.c +1
-1@@ -5319,7 +5319,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,switch (cmd->code) {case L2CAP_COMMAND_REJ : -l2cap_command_rej (conn, cmd, cmd_len, data); + err =l2cap_command_rej (conn, cmd, cmd_len, data);break ;
this patch is wrong. Please try to understand on how L2CAP works and look up what the caller of l2cap_bredr_sig_cmd does with the return code. Responses can not cause another command reject.
Regards
Marcel