[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB02275D7@AcuExch.aculab.com>
Date: Thu, 24 Nov 2016 12:51:05 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jiri Slaby' <jslaby@...e.cz>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
CC: Vlad Yasevich <vyasevich@...il.com>,
Neil Horman <nhorman@...driver.com>,
"David S. Miller" <davem@...emloft.net>,
"linux-sctp@...r.kernel.org" <linux-sctp@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [patch added to 3.12-stable] net: sctp, forbid negative length
From: Jiri Slaby
> Sent: 24 November 2016 09:18
> This patch has been added to the 3.12 stable tree. If you have any
> objections, please let us know.
>
> ===============
>
> [ Upstream commit a4b8e71b05c27bae6bad3bdecddbc6b68a3ad8cf ]
>
> Most of getsockopt handlers in net/sctp/socket.c check len against
> sizeof some structure like:
> if (len < sizeof(int))
> return -EINVAL;
>
> On the first look, the check seems to be correct. But since len is int
> and sizeof returns size_t, int gets promoted to unsigned size_t too. So
> the test returns false for negative lengths. Yes, (-1 < sizeof(long)) is
> false.
Would it be worth adding the check in the generic setsockopt/getsockopt system
call code instead of in each and every protocol?
(Clearly for net-next, not stable.)
David
Powered by blists - more mailing lists