bnep:Add error paths for failed function calls in the function bnep_ctrl_set_netfilter
Subsystems (2)
PATCH RESEND 1/1 bnep:Add error paths for failed function calls in the function bnep_ctrl_set_netfilter
This adds the proper error paths for when the calls to the function bnep_send_rsp fail by returning a error code and if this arises jump to a new goto label out where we directly return the error code to the caller to signal this failure.
Signed-off-by Nicholas Krause <[email protected]>
--- net/bluetooth/bnep/core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/bluetooth/bnep/core.c +10 -4
@@ -103,6 +103,7 @@ static inline void bnep_set_default_proto_filter(struct bnep_session *s)static int bnep_ctrl_set_netfilter (struct bnep_session *s,__be16 *data,int len) {int n; +int err =0 ;if (len <2 )return -EILSEQ ;
@@ -136,14 +137,19 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int lenif (n ==0 )bnep_set_default_proto_filter (s); - bnep_send_rsp(s, BNEP_FILTER_NET_TYPE_RSP, BNEP_SUCCESS); + err =bnep_send_rsp (s,BNEP_FILTER_NET_TYPE_RSP ,BNEP_SUCCESS ); +if (err) + goto out; }else { -bnep_send_rsp (s,BNEP_FILTER_NET_TYPE_RSP ,BNEP_FILTER_LIMIT_REACHED ); + err =bnep_send_rsp (s,BNEP_FILTER_NET_TYPE_RSP ,BNEP_FILTER_LIMIT_REACHED ); +if (err) + goto out; }#else -bnep_send_rsp (s,BNEP_FILTER_NET_TYPE_RSP ,BNEP_FILTER_UNSUPPORTED_REQ ); + err =bnep_send_rsp (s,BNEP_FILTER_NET_TYPE_RSP ,BNEP_FILTER_UNSUPPORTED_REQ );#endif -return 0 ; +out: +return err; }static int bnep_ctrl_set_mcfilter (struct bnep_session *s,u8 *data,int len)
Signature · 1 line
2.1.4