On Thu, Feb 28, 2019 at 07:23:56AM -0500, Neil Horman wrote:
> On Wed, Feb 27, 2019 at 11:19:58PM -0300, Marcelo Ricardo Leitner wrote:
> > On Wed, Feb 27, 2019 at 05:00:24PM -0800, David Miller wrote:
> > > 
> > > Pass this, instead of an event.  Then everything trickles down and we
> > > always have events a non-empty list.
> > > 
> > > Then we needs a list creating stub to place into .enqueue_event for 
> > > sctp_stream_interleave_1.
> > > 
> > > Signed-off-by: David S. Miller <da...@davemloft.net>
> > > ---
> > >  net/sctp/stream_interleave.c | 44 +++++++++++++++++++++++++++---------
> > >  1 file changed, 33 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/net/sctp/stream_interleave.c b/net/sctp/stream_interleave.c
> > > index b6b251b8b3cf..0bc3d9329d9a 100644
> > > --- a/net/sctp/stream_interleave.c
> > > +++ b/net/sctp/stream_interleave.c
> > ...
> > > @@ -866,11 +867,15 @@ static int sctp_ulpevent_idata(struct sctp_ulpq 
> > > *ulpq,
> > 
> > More context:
> >         if (!(event->msg_flags & SCTP_DATA_UNORDERED)) {
> >                 event = sctp_intl_reasm(ulpq, event);       [1]
> >                 if (event && event->msg_flags & MSG_EOR) {  [2]
> >                         skb_queue_head_init(&temp);
> >                         __skb_queue_tail(&temp, sctp_event2skb(event));
> > 
> >                         event = sctp_intl_order(ulpq, event);
> > >           }
> > >   } else {
> > >           event = sctp_intl_reasm_uo(ulpq, event);
> > > +         if (event) {
> > > +                 skb_queue_head_init(&temp);
> > > +                 __skb_queue_tail(&temp, sctp_event2skb(event));
> > > +         }
> > >   }
> > >  
> > >   if (event) {
> > >           event_eor = (event->msg_flags & MSG_EOR) ? 1 : 0;
> > > -         sctp_enqueue_event(ulpq, event);
> > > +         sctp_enqueue_event(ulpq, &temp);
> > 
> > [1] can return an event without MSG_EOR (a partial delivery), which
> > would skip the condition on [2] and cause temp to not be initialized
> > by here.  Same applies to sctp_ulpq_tail_data().
> > 
> I agree, it seems we canjust drop the msg_flags check and just key off of 
> event
> being non-null, no?

Yes. Like:

        if (!(event->msg_flags & SCTP_DATA_UNORDERED)) {
                event = sctp_intl_reasm(ulpq, event);
                if (event) {
                        skb_queue_head_init(&temp);
                        __skb_queue_tail(&temp, sctp_event2skb(event));

                        if (event->msg_flags & MSG_EOR)
                                event = sctp_intl_order(ulpq, event);
                }

Or some other clever way to handle it and reduce amount of the 'if
(event)' checks that we have in there. Maybe 'if (!event) goto out;'
helps.

  Marcelo

> 
> Neil
> 
> > It's the only thing I noticed on the series. Will test it tomorrow.
> > 
> > >   }
> > >  
> > >   return event_eor;
> > ...
> > 

Reply via email to