From patchwork Sat Oct 22 07:22:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096559wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ht5xAMHyDRblZx/Dkq4oC6OUSMEkzJf8CiXbdND+osvwl5TSo71khRw//u8FocJRjV6hu X-Received: by 2002:a17:90a:cf06:b0:212:d9ab:811b with SMTP id h6-20020a17090acf0600b00212d9ab811bmr5369362pju.65.1666425926307; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=eLPKCtKNbCSAeEgQA9iRQigjP5Wtf2C86tWhJ1BNj3Fgae7tul3AFPbK1Mf8cRVCjz dnOzp5xzii4MqFvyHGPF4h7BxS9Xjw4NuJE5U0UhxoiUyQJYc9MSLrNnXyL2hIwIvc40 BSNhqdmoTBYcQVkhw3Ah73J5yooBTF8HjbymKLecTWYSR74vD896MfwINCIcdn49IEds Hu9NeALtUEEaIlV/pEoWk0O53Q1qCkP/EdJvh9GWWOGtCZk0eIuWpfEq7A2IV+hq3J6z sFhBtbcBfdT43DrAV+lcyHK3XmsQnFeceibWEu8xvv32siCwyJ1p4SPRSn1yJnK4A+R8 fmBg== 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=H2e7y1sYXqrXeGy2KXktBigbXNeCvcebPWS3U5Oo238=; b=MAFVYZ0CzyRz2yoJ6WdoZq//m7hKKYWdZlXrD03aSN0G1oHRMABEOv2Ls8zCTmgwNj a65QqHa92oHYeFojB8NaOOGaF0rngR5PwyNukJCVrmBmQM7qalPX0OLe37pcQn7ySr9l TJ4ULFO+xKxEDQLU1B/8zpzNzNYCYvhxCs9VQc/SN8jmdPnagsBIawpnlDkdo1GAkbm3 g8uF7A3eebXJiZs3EuolCxXh8DYW14epeSVJ+zfdNSijGGGlBZPw/T8rxsrfuAGQ3zoM d3KgxvRQbNiONnLdC/Fb+TwCJksT+iZCllHMFIbxlJ9WeGiup4tnc24Sxw6eTAB+5CCV QEAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1BOzT+cx; 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 d4-20020a655ac4000000b0043c5d3dc0d4si28988839pgt.332.2022.10.22.01.05.13; Sat, 22 Oct 2022 01:05:26 -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=1BOzT+cx; 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 S232802AbiJVIEP (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232357AbiJVH6A (ORCPT ); Sat, 22 Oct 2022 03:58:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC7A312276F; Sat, 22 Oct 2022 00:49: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 dfw.source.kernel.org (Postfix) with ESMTPS id E713060ACE; Sat, 22 Oct 2022 07:48:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 011ADC433C1; Sat, 22 Oct 2022 07:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424936; bh=4skOxrJgX4AfIkPHOIg87BN7DK+WMUVYiGNtnr5td+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1BOzT+cxYOWd4g+16P9RykHSdptaPh22Hb3uBdmVYzShbDIJNdK2MlaINZY8hNxMv 6gIuGf67d+4ZOVJ0RoC0Jr9j8VU9dfS/qarxKNPqEctH4nw+H5ORgvM+LSbJtIOv2d fhuXEXRE0cLV2cTXpEslH/RAD9hzLyw8F3AX2RTc= 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.19 292/717] net/ieee802154: reject zero-sized raw_sendmsg() Date: Sat, 22 Oct 2022 09:22:51 +0200 Message-Id: <20221022072505.011272412@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374232232599401?= X-GMAIL-MSGID: =?utf-8?q?1747374232232599401?= 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 7889e1ef7fad..cbd0e2ac4ffe 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -251,6 +251,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);