From patchwork Tue Sep 29 10:58:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 291195 Return-Path: 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=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 9D13DC4727C for ; Tue, 29 Sep 2020 11:13:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D4DF21D46 for ; Tue, 29 Sep 2020 11:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377987; bh=Wubh1/an2GrwMUL1dHNmyv0XO1Vj8IER5x5XkGGuNeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=s/NYMcXItTbO19TmBAliypr+46SCzGDDFecDsybfBdcYfQRr754GsaiaU2Ix12fNF yaKP3gg2XJpZTX83BUyEkVPp6dKI3kmGqywnolJg7V2PLlLL7Snc2EpZSF3MnWwlEi d7S8jkB+UMJA3ZjxtvRpuXUr79JZuiycjnXprTdQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728953AbgI2LNG (ORCPT ); Tue, 29 Sep 2020 07:13:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:54618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727985AbgI2LMn (ORCPT ); Tue, 29 Sep 2020 07:12:43 -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 7DA9120848; Tue, 29 Sep 2020 11:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377963; bh=Wubh1/an2GrwMUL1dHNmyv0XO1Vj8IER5x5XkGGuNeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ijANW8ulYsItJboligV4JDJR5LvCdbFmXBEYJqFdW0N65SjVqIvisXua2+fFo5dDC lfeyhkk5QVxYerUwIqqrGkmCEqPZ/z9YSu2WVKgqKqd1K+QTYf/Suo44b19zUcqw7X U/xSlN3TB5WIJNPB++pMi+3j8Do2xaCQevvrKFkI= 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.14 014/166] net: add __must_check to skb_put_padto() Date: Tue, 29 Sep 2020 12:58:46 +0200 Message-Id: <20200929105935.900251428@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105935.184737111@linuxfoundation.org> References: <20200929105935.184737111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -2999,8 +2999,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; @@ -3023,7 +3024,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); }