Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1083937pxk; Fri, 25 Sep 2020 05:58:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxe1MflUknV5abQU3Z8KPsLE8jvd8PG8hXtq0vj5T/sR+XLEcDDU45vmQlppgEgZfA/c6E0 X-Received: by 2002:a50:8e58:: with SMTP id 24mr1209541edx.226.1601038694579; Fri, 25 Sep 2020 05:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601038694; cv=none; d=google.com; s=arc-20160816; b=Uikjuh9W4uoVNIHP4l7bBWxeTP4ZWnLNi5TbdQeJKZjQ0DzkKLOAhXWigabCSfgN1l In32fBolKZ4dj9ZgxQZ9yCepdShTm/m0fkFG9x0gak81SxNNUsdB5OqGQjlFAMXhm4yZ lNuEEc2K63D1N1PlbW/k6jMbvPIDFJ7PttC1V4UZCwV5nqVjx3UaSlyTNrlUSBkaUqfw kuN46X08xk0WDElHGLMB1oug/dhMdVJiaA2rkyOy3wSOtOo6pdJI+GVeGXFY6YuQj0gj hkTouT97OYA9zE9Fn4tgvaMvUz3xW3M6LwRLHLMdYfzT72XYzx0Ix9HEj9EghbRyV4iE RapA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eKvUh/xIB/R7VRXrI6i3MkCbUKLtnf7UqM7dGSW3Zmw=; b=NzNoAOYgUGyGr9Oa4WLFoPPfGQ9P3mlUnCQRKSAm3JGPRopUfR+ZfXcA4clpz2nBvR Ovi3Cf2DPFCB4C11F1wR2MfA+V9hc0HK1qL719T/S1doSF0Q+reUlQEN65h0HXz75gok 4i3AuP/Dzae2VFqeR1Kg9aJESoa3yrs5W7B1phG/YpJTZBqcTvJFl/D6bJFZC3glab0a foPWwQfZubTx3gRMmF+BdbSA/+Ph8uQ6pTwFZ8QTUWoIk94j2OybOrshdbYoF32taOyQ 5KN+zkpL7WJj8DtkAxo01XuMvONYBqfWHYFtv5oCE5ZgFSScRkESpQHnFdzy/Df3ZF0i 1Sjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gi7y9VhZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yr3si1665053ejb.322.2020.09.25.05.57.51; Fri, 25 Sep 2020 05:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gi7y9VhZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729524AbgIYMyK (ORCPT + 99 others); Fri, 25 Sep 2020 08:54:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:60516 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728365AbgIYMyH (ORCPT ); Fri, 25 Sep 2020 08:54:07 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 02D1B2072E; Fri, 25 Sep 2020 12:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038447; bh=delpviO4pXh2YsWXBUFYRjSsf2CZCAW+dQcpg3WDQos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gi7y9VhZ7Vc3fgt9ylD5gDsPqv4JfGs6FZMi3Jxob2BtAghliCMApLPOfX34Dr0U5 O+yDHXQ8CSX+PtERmpR5ZZmKpd4+ppwQh6fC0djp4kkfEBVI7uhBpUOU0aGbI6rWck UmRvjtKUoIpR3wViCiFMwl4FsZQEyhIXZwFfqjhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 4.19 22/37] net: add __must_check to skb_put_padto() Date: Fri, 25 Sep 2020 14:48:50 +0200 Message-Id: <20200925124724.288529564@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200925124720.972208530@linuxfoundation.org> References: <20200925124720.972208530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet [ Upstream commit 4a009cb04aeca0de60b73f37b102573354214b52 ] skb_put_padto() and __skb_put_padto() callers must check return values or risk use-after-free. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/linux/skbuff.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3014,8 +3014,9 @@ static inline int skb_padto(struct sk_bu * is untouched. Otherwise it is extended. Returns zero on * success. The skb is freed on error if @free_on_error is true. */ -static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len, - bool free_on_error) +static inline int __must_check __skb_put_padto(struct sk_buff *skb, + unsigned int len, + bool free_on_error) { unsigned int size = skb->len; @@ -3038,7 +3039,7 @@ static inline int __skb_put_padto(struct * is untouched. Otherwise it is extended. Returns zero on * success. The skb is freed on error. */ -static inline int skb_put_padto(struct sk_buff *skb, unsigned int len) +static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int len) { return __skb_put_padto(skb, len, true); }