From: Eldad Zinger Date: Mon, 14 Jun 2010 10:03:16 +0000 (+0300) Subject: sdp: sdp_recvmsg() shouldn't handle SDP_MID_DISCONN when MSG_PEEK flag is up. X-Git-Tag: v4.1.12-92~264^2~5^2~168 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5a126afd99b63c00554b984833cb0ecaf87e055c;p=users%2Fjedix%2Flinux-maple.git sdp: sdp_recvmsg() shouldn't handle SDP_MID_DISCONN when MSG_PEEK flag is up. Signed-off-by: Eldad Zinger --- diff --git a/drivers/infiniband/ulp/sdp/sdp_main.c b/drivers/infiniband/ulp/sdp/sdp_main.c index 73db7d0bea7bf..a631a2517ba49 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: