From patchwork Mon Oct 24 11:28: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: 10161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640141wru; Mon, 24 Oct 2022 13:31:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LvdYunIdRxR5LAinxXTITnqct4anZyVeyU6D9r8p8Ta2ZAn1DD9kkNah2EIBmPdQ4OUXY X-Received: by 2002:a17:902:820a:b0:178:456e:138 with SMTP id x10-20020a170902820a00b00178456e0138mr35279594pln.145.1666643510298; Mon, 24 Oct 2022 13:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643510; cv=none; d=google.com; s=arc-20160816; b=whY7mUx586M6xekUX2SgGoMINC2yTMyMiCQ8nPtaq/DVL++mc/QjBmEYCVXaDmiLL2 EmvmteacnAh7dq1gQwhYfc+VkzpTAgU5CTYxhHTZRmKC9yA2N9neAObOym+xaHfJxom3 B1qInNKavCYqlFgjWknc4gj9gBrVftH7bXPV1vLrcus8qWlLtEmiAMZwP4kL4oGbQZ5A Nw2WEgTmtji4s37T9nRbjUO2XM9Bq9mJd8KOiWNt5hYX6tYEXvZqwXKp656IGn0kLPC7 pHqwSg6PFs/U5pkwQBVKSalqUPvJPcB0t7v8Ahscr/3zXZ4EStGF5IdSo3ZYUMRjwlfh s1wA== 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=8yQ2d0e0v7TVAFcTm7DMifNlb1Bp2LDgPtKJ12A1QpA=; b=uINOMHGypSpih4ce9DEEi6jl9i4pi4L3CiZX8yRu+vNY8DwaN2miTvoFMkp36Ami0Y rFrfkVDD1CueapBGCgXWoPEJrGJyjU7QFpzRu0yXeJ/vqW26XmaHfPbUXsCEMPbBxed8 cyfhmX8C+UanLesqabGF8n9trJc1GIN5s8Mduqd59PNI9CCXTG8xecQD6bfppwQa8qAd uq6PFGQGUXnAlBNLg8TgvBFIU90mZx7WDU8ma3mMZBiN4IpgRfC3YoURPXFYEMnJGFyb GSue53DkShF+O4xyIgWeG3QtYZ9ZXN7qk9ADfJlWBTjj/2iwonTFvTmsB1lUS1zu3avw 2rFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qaJcT9bk; 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 l1-20020a170902f68100b0017f92d54633si656803plg.243.2022.10.24.13.31.35; Mon, 24 Oct 2022 13:31:50 -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=qaJcT9bk; 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 S233887AbiJXUVB (ORCPT + 99 others); Mon, 24 Oct 2022 16:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232593AbiJXUUd (ORCPT ); Mon, 24 Oct 2022 16:20:33 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D51D52D750; Mon, 24 Oct 2022 11:37:04 -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 sin.source.kernel.org (Postfix) with ESMTPS id 337B6CE13C6; Mon, 24 Oct 2022 12:21:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F0D5C433C1; Mon, 24 Oct 2022 12:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614116; bh=hgLAecfST81JQUjnVK80uoGvvVWrskI4THhMVg9VXsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qaJcT9bkhjZT3Hy4/BbXTi0kE+de8OSWV077u4xT6dWMxrLkQm+u9MzzJZjHyJ4uV 1AGgUB9qlLUUI2IE99cnfyMw1UbiPWdksD8ramhcWjAyapz+F4lH6NrSOe/e8qVdpZ eSna75qYCXLqXf3DxXh0uOfTVLrq90sG97oxDkvw= 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.10 138/390] net/ieee802154: reject zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:28:55 +0200 Message-Id: <20221024113028.548075544@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747602385639002426?= X-GMAIL-MSGID: =?utf-8?q?1747602385639002426?= 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 7edec210780a..d4c162d63634 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);