Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1086510pxk; Fri, 25 Sep 2020 06:01:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQK3obbB5HDSAJqU/3CgdBhmizyBzW+9tirsnpqEAvigdAi2fjYqRv6+Uo+25Aw+mYgnIT X-Received: by 2002:a17:906:1fd5:: with SMTP id e21mr2684262ejt.349.1601038918222; Fri, 25 Sep 2020 06:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601038918; cv=none; d=google.com; s=arc-20160816; b=hH1Uy8obvYH0AzgYSSGK2n68euoSf46EZVoQSik/sFA8ghuhhLIgYHERvnCPWkJc0T JnAWptfAABkuyY4d4ewpA/qY5IR46ZC1doqFHfrGnUPyCr1nKAyLhzbeQvrrwmwtGIux FzEV4cGV3ubX26Eadu+UOiIforR6yRAOr2AOPZt0ZvCV/MCr9hpNMNYkNvl2sZs1sBrs zwA4EtCduHisD7YWF3ORYgQLGkTyiwHBIYK8ziuduywV5flm2p9ZyQuieSN3dEDL1+O2 p4l7Nl1NNll2kADP40eQWFdWjDTMfqJk6ji0Df08VighpgDY3/JZN+y5KP9SFWkYl59Q XNsA== 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=59++4cOnN6cDAyA8O6Rr7VplMxVbAzg3tq8vsixzM2I=; b=pGcG8l1EJlLgX3wGim5cGeVpWHu2h6cwOtrBAs5cm5NaHk4nslKnLeP1ASQMd0M0lf huc/MzsAPddH0RT+DYraGFumAOHso/wWpr50JV0F257XMymBKO0g7Ss9JDSzqkQ7rs/Y S2mDr5S/NfIJhco/WPihCNCelIc2jZSvPv7Tft3nr4cTwvr2v8zOcMUEYAeBYkjicdNU kvFQHCIj9ogapqwYSL3BG/pFHDA7AGGiQX/fT6TW0EXaHMue5Kbgnr+OymE/baKVwBIx RKFvOAOFtbGePrG/cOz3WLRHipzRyuAO4JFD1RwKaCL1RsqdLwm6K6oqkX77FA0/4D9U eYkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1S1z6pLA; 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 d2si1938198ejm.716.2020.09.25.06.01.35; Fri, 25 Sep 2020 06:01:58 -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=1S1z6pLA; 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 S1729294AbgIYM5M (ORCPT + 99 others); Fri, 25 Sep 2020 08:57:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:55208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729154AbgIYMvH (ORCPT ); Fri, 25 Sep 2020 08:51: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 2B2EC206DB; Fri, 25 Sep 2020 12:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038266; bh=0Tmpdw6N71PRbb7aCXjelqKZtzWw3UqqAEr+hFpvGTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1S1z6pLA73Lo1s/Mnm5kNcb3JtX2YglXry8Zcl8Z6WWJtLKSiXBvsRKmXZxMFa0DI jfY4oQjp6yQOcoycPJyh6qYCFQHrqrKEe09v9bWeoTfxpwDzxnxX0aKvmCF/Kp3ePM k8RmNQga/jo+Fwc79rpLNC3IBYOojad8vYVme0z8= 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 5.8 42/56] net: add __must_check to skb_put_padto() Date: Fri, 25 Sep 2020 14:48:32 +0200 Message-Id: <20200925124734.168669943@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200925124727.878494124@linuxfoundation.org> References: <20200925124727.878494124@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 @@ -3208,8 +3208,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; @@ -3232,7 +3233,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); }