[SCTP]: Fix SCTP_SHUTDOWN notifications.

Fix to allow SCTP_SHUTDOWN notifications to be received on 1-1 style
SCTP SOCK_STREAM sockets.

Add SCTP_SHUTDOWN notification to the receive queue before updating
the state of the association.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Sridhar Samudrala and committed by David S. Miller eb0e0076 1dfbab59

+11 -11
+11 -11
net/sctp/sm_statefuns.c
··· 2414 2414 skb_pull(chunk->skb, sizeof(sctp_shutdownhdr_t)); 2415 2415 chunk->subh.shutdown_hdr = sdh; 2416 2416 2417 + /* API 5.3.1.5 SCTP_SHUTDOWN_EVENT 2418 + * When a peer sends a SHUTDOWN, SCTP delivers this notification to 2419 + * inform the application that it should cease sending data. 2420 + */ 2421 + ev = sctp_ulpevent_make_shutdown_event(asoc, 0, GFP_ATOMIC); 2422 + if (!ev) { 2423 + disposition = SCTP_DISPOSITION_NOMEM; 2424 + goto out; 2425 + } 2426 + sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); 2427 + 2417 2428 /* Upon the reception of the SHUTDOWN, the peer endpoint shall 2418 2429 * - enter the SHUTDOWN-RECEIVED state, 2419 2430 * - stop accepting new data from its SCTP user ··· 2449 2438 */ 2450 2439 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_CTSN, 2451 2440 SCTP_U32(chunk->subh.shutdown_hdr->cum_tsn_ack)); 2452 - 2453 - /* API 5.3.1.5 SCTP_SHUTDOWN_EVENT 2454 - * When a peer sends a SHUTDOWN, SCTP delivers this notification to 2455 - * inform the application that it should cease sending data. 2456 - */ 2457 - ev = sctp_ulpevent_make_shutdown_event(asoc, 0, GFP_ATOMIC); 2458 - if (!ev) { 2459 - disposition = SCTP_DISPOSITION_NOMEM; 2460 - goto out; 2461 - } 2462 - sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); 2463 2441 2464 2442 out: 2465 2443 return disposition;