netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: doronrk@fb.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] strparser: Fix incorrect strp->need_bytes value.
Date: Thu, 12 Apr 2018 21:56:02 -0400 (EDT)	[thread overview]
Message-ID: <20180412.215602.1300513196203204706.davem@davemloft.net> (raw)
In-Reply-To: <20180411220516.3062277-1-doronrk@fb.com>

From: Doron Roberts-Kedes <doronrk@fb.com>
Date: Wed, 11 Apr 2018 15:05:16 -0700

> strp_data_ready resets strp->need_bytes to 0 if strp_peek_len indicates
> that the remainder of the message has been received. However,
> do_strp_work does not reset strp->need_bytes to 0. If do_strp_work
> completes a partial message, the value of strp->need_bytes will continue
> to reflect the needed bytes of the previous message, causing
> future invocations of strp_data_ready to return early if
> strp->need_bytes is less than strp_peek_len. Resetting strp->need_bytes
> to 0 in __strp_recv on handing a full message to the upper layer solves
> this problem.
> 
> __strp_recv also calculates strp->need_bytes using stm->accum_len before
> stm->accum_len has been incremented by cand_len. This can cause
> strp->need_bytes to be equal to the full length of the message instead
> of the full length minus the accumulated length. This, in turn, causes
> strp_data_ready to return early, even when there is sufficient data to
> complete the partial message. Incrementing stm->accum_len before using
> it to calculate strp->need_bytes solves this problem.
> 
> Found while testing net/tls_sw recv path.
> 
> Fixes: 43a0c6751a322847 ("strparser: Stream parser for messages")
> Signed-off-by: Doron Roberts-Kedes <doronrk@fb.com>

Applied and queued up for -stable.

      reply	other threads:[~2018-04-13  1:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11 22:05 [PATCH net] strparser: Fix incorrect strp->need_bytes value Doron Roberts-Kedes
2018-04-13  1:56 ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180412.215602.1300513196203204706.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=doronrk@fb.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).