From patchwork Mon Oct 24 11:29:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp550149wru; Mon, 24 Oct 2022 09:45:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ru6NCwroBZDSG00rf9bVyZha8moGKFXNVjpugWeT6Tx2KKUdG51EtGBb09peKyidsausv X-Received: by 2002:a17:902:ce8a:b0:186:9d96:b93c with SMTP id f10-20020a170902ce8a00b001869d96b93cmr9115854plg.123.1666629925856; Mon, 24 Oct 2022 09:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629925; cv=none; d=google.com; s=arc-20160816; b=zwB7XSC/aYWdQuk369veN6tDMMtbNaJoNKmcS4Uh2ZjUUl0G7Hn1g+fTzS0Q+Q2uOh goY4RWgDRnMa7S1t0PGlRL4CGPJkmbhbunGp7UHJ8G13jMRTnUMIrk5JYQCOlFB7M53K 3SRbRH5D5+mueH21EpoFnqQiuKCcuCHMfAwrTyJsXRaP0jbgYBbPYSdA1usY9xdqDWv9 K5Ule05Y3mQNj4ZUS3gjT1d0ZNJ5vUqoSoL05wqMocrqOKxbnNNjxEyJvW+PtdraLyAO qFUfwCK9fTQZ0D4Qci2mTrOCkVg4tJwwI3LKP+MwUXKbuS8MN66BUlMa0AnWERIaAQM5 g9MQ== 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=kgMqsa4gIHo+CIEZFHkTYNu7cUqVkPpfui9P6NY/Mkc=; b=lUXDN/UwByZgp/oUyHg23vTa/28IVGLvoKYk9+Vyuuf3s7cw+sLECq29AtWOh4rnwI FXEQQDAkGSjfuF5iqO171qLhNozO8VBXgNwz0rviM8qL4X9UsjA0PcC5Whp0uQk+eIwx h3raX99D8jUJCtS1Ik/Cl0GK+Ub0JP9NQ0iqHQpQsBhymlO00WinqRNBd+z0mVQCz/Pj Fvm1fQigKEZV/zM/GHHxSjHFqNG3AfN4ddWc6DbbE2sYnfh1Xt/3CfHeou9NnTajEOdC K1zPonsG/EnDWPfTATz/e3dVUb0RO8YKrZ40QKR+3BhWAkAaNPEz5Q+y9ZJPGNxmxIk8 LU/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A4TO2c5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a6555cc000000b0041cefab5b61si36971632pgs.719.2022.10.24.09.45.12; Mon, 24 Oct 2022 09:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A4TO2c5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234782AbiJXQov (ORCPT + 99 others); Mon, 24 Oct 2022 12:44:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234910AbiJXQoC (ORCPT ); Mon, 24 Oct 2022 12:44:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7635B88A0A; Mon, 24 Oct 2022 08:30:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26AE0B81263; Mon, 24 Oct 2022 12:08:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CA6EC433D7; Mon, 24 Oct 2022 12:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613305; bh=j5N1rRaBQUoxQJhkXMaxZ4cTTEwSn03DWlIFc7ndmlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A4TO2c5YJ27pFscnfWER9NfQEZ6Rg0zLWCekDuFn7QXEKzMyKnr2vmoFRCb0fKNmN ftXYm/gqB5vVd6H0IPdPso3rp5rbFG1a+socxb1I1vPj852gUP7Aa1nURuUtorDLEt C+j2MIoovl4uLpf+FAfQJloRTXbk3tLAlrCn4mGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 085/255] net/ieee802154: reject zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:29:55 +0200 Message-Id: <20221024113005.332271068@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588140792653545?= X-GMAIL-MSGID: =?utf-8?q?1747588140792653545?= From: Tetsuo Handa [ Upstream commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5 ] syzbot is hitting skb_assert_len() warning at raw_sendmsg() for ieee802154 socket. What commit dc633700f00f726e ("net/af_packet: check len when min_header_len equals to 0") does also applies to ieee802154 socket. Link: https://syzkaller.appspot.com/bug?extid=5ea725c25d06fb9114c4 Reported-by: syzbot Fixes: fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") Signed-off-by: Tetsuo Handa Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index a92b11999e5f..72637d5994d8 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -252,6 +252,9 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) return -EOPNOTSUPP; } + if (!size) + return -EINVAL; + lock_sock(sk); if (!sk->sk_bound_dev_if) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154);