On Sun, 2017-04-02 at 13:45 +0200, Florian Westphal wrote: > Eric Dumazet <eric.duma...@gmail.com> wrote: > > - for (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += > > optlen(opt, i)) { > > + for (i = sizeof(struct tcphdr); i < tcp_hdrlen - TCPOLEN_MSS; i += > > optlen(opt, i)) { > > if (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) { > > u_int16_t oldmss; > > maybe I am low on caffeeine but this looks fine, for tcp header with > only tcpmss this boils down to "20 <= 24 - 4" so we acccess offsets 20-23 > which seems ok.
I am definitely low on caffeine ;) An issue in this function is that we might add the missing MSS option, without checking that TCP options are already full. But this should not cause a KASAN splat, only some malformed TCP packet (tcph->doff would wrap)