From 5a126afd99b63c00554b984833cb0ecaf87e055c Mon Sep 17 00:00:00 2001 From: Eldad Zinger Date: Mon, 14 Jun 2010 13:03:16 +0300 Subject: [PATCH] sdp: sdp_recvmsg() shouldn't handle SDP_MID_DISCONN when MSG_PEEK flag is up. Signed-off-by: Eldad Zinger --- drivers/infiniband/ulp/sdp/sdp_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/infiniband/ulp/sdp/sdp_main.c b/drivers/infiniband/ulp/sdp/sdp_main.c index 73db7d0bea7b..a631a2517ba4 100644 --- a/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/drivers/infiniband/ulp/sdp/sdp_main.c @@ -2188,6 +2188,14 @@ static int sdp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, switch (h->mid) { case SDP_MID_DISCONN: + if (flags & MSG_PEEK) { + /* There is no point of handling a + * remote disconnection request while + * MSG_PEEK. The remote disconnection + * request will be handled upon regular + * recv. */ + goto got_disconn_in_peek; + } sdp_dbg(sk, "Handle RX SDP_MID_DISCONN\n"); sdp_prf(sk, NULL, "Handle RX SDP_MID_DISCONN"); sdp_handle_disconn(sk); @@ -2453,6 +2461,7 @@ found_fin_ok: } while (len > 0); +got_disconn_in_peek: err = copied; out: -- 2.50.1