Message ID | 20200601174017.232490389@linuxfoundation.org |
---|---|
State | Superseded |
Headers | show
Return-Path: <SRS0=Ycwd=7O=vger.kernel.org=stable-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C347FC433DF for <stable@archiver.kernel.org>; Mon, 1 Jun 2020 18:56:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9EC8320679 for <stable@archiver.kernel.org>; Mon, 1 Jun 2020 18:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591037818; bh=oqkKnpN3JQgcqYTFZVsmVD/urZXJAlIzlMfHX9kho9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cxEnPxLTO/W9nkngAth9SPEnkzCaqRA8Zfu08br6XgebcWZFt0FxAgeITwOTiPoF8 Uchy1XjZ1MZA5+1yk0GF1uRWrG4gy7nP9CSbLW5HZv+hC/zBlkY4X9Kkuv7jFwkxlK wCLqM0AdUT2oqPFTrnpm3nAF2vLpI9L2s4u1qmk0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729605AbgFASAL (ORCPT <rfc822;stable@archiver.kernel.org>); Mon, 1 Jun 2020 14:00:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:42806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729604AbgFASAK (ORCPT <rfc822;stable@vger.kernel.org>); Mon, 1 Jun 2020 14:00:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4CAB22073B; Mon, 1 Jun 2020 18:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034409; bh=oqkKnpN3JQgcqYTFZVsmVD/urZXJAlIzlMfHX9kho9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wh6z/EcFQIUVRech6ZSk8ZCF1bi1Pn+4q2RxP+CaNtJhfus0TO0lmAKialOHo7a+m SMPgq15avqcRG3vC2gjeJM6piOCo+75kRlL7be1R9uUpZyfniwCYzGCF5AScAZ9D/R I6qihXpu4J9VKCVxjK/PXJMZE6n2WGiKhYGqF9Tc= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>, Eric Dumazet <edumazet@google.com>, "David S. Miller" <davem@davemloft.net>, Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>, Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>, Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@resnulli.us>, Arvind Sankar <nivedita@alum.mit.edu>, Jiong Wang <jiongwang@huawei.com>, Yuqi Jin <jinyuqi@huawei.com>, Shaokun Zhang <zhangshaokun@hisilicon.com> Subject: [PATCH 4.14 04/77] net: revert "net: get rid of an signed integer overflow in ip_idents_reserve()" Date: Mon, 1 Jun 2020 19:53:09 +0200 Message-Id: <20200601174017.232490389@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174016.396817032@linuxfoundation.org> References: <20200601174016.396817032@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
--- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -499,18 +499,16 @@ u32 ip_idents_reserve(u32 hash, int segs atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ; u32 old = ACCESS_ONCE(*p_tstamp); u32 now = (u32)jiffies; - u32 new, delta = 0; + u32 delta = 0; if (old != now && cmpxchg(p_tstamp, old, now) == old) delta = prandom_u32_max(now - old); - /* Do not use atomic_add_return() as it makes UBSAN unhappy */ - do { - old = (u32)atomic_read(p_id); - new = old + delta + segs; - } while (atomic_cmpxchg(p_id, old, new) != old); - - return new - segs; + /* If UBSAN reports an error there, please make sure your compiler + * supports -fno-strict-overflow before reporting it that was a bug + * in UBSAN, and it has been fixed in GCC-8. + */ + return atomic_add_return(segs + delta, p_id) - segs; } EXPORT_SYMBOL(ip_idents_reserve);