From patchwork Wed Oct 19 08:27:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247593wrs; Wed, 19 Oct 2022 03:41:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+ljCrCqzkVE7ey9KaM+AzafgduF4Hh5LAReX9YkSL8zXzikoq2Wi/NHjrqnZxIn6TGmkm X-Received: by 2002:a05:6402:50cf:b0:45c:dfce:66ae with SMTP id h15-20020a05640250cf00b0045cdfce66aemr6516762edb.370.1666176073694; Wed, 19 Oct 2022 03:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176073; cv=none; d=google.com; s=arc-20160816; b=hu42+rFt6hKR4igcebVnJhAblm/dYrlnIWSmagk4gwLkO5LzFPmwsxhg6xMzYwpOCR L1aU6BAibHof1wqlXC7IXXobIR5OVkIoy70018hxClRtUJLa8it9RNGHV4gc32Gms8I1 l44NZsj26rlB8odGjAUKEIp2HrqHKBjKDfSqSas9O01EVXAzgxyCNjx+d+POyYYDfARR lG0DY6VZFKZ4NSgIz36Q0niFTi9IufRiPH3n387WPr//dtFWaImdWFDdx7ECPXzjfnGk 7nJ3zIDKeuIQj6TrXga3+ZVCdKauyRTP9lkACmqdlc8Mnz2cRnUg1REU4V6zmvY0lDQS NV+g== 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=dTCr5tCoYP+R/BI8edPLmynnf2ym8/i5rreSzneO0Lh6LvGbnwL5q14NLdRfVepGZN F5YAFBY17fDGdhXygVB77oCe1IRIGlF+k2K9RTaq6X2rnxBfCBOSgg6quWyYaAdVrQxu jXhDT/4BdUTOWOmxnBCQl0wtUoiXZ3juQVI7XcT3U7WunPfTNT/p9fSKLBgdkn1KBbB8 KO5zQjGZlWlBBSdiS2coss/9gPTfDZLMQGmx0SSkvaGiPNPhp3EeiYACkLPrHePYqOh4 KUY3pFcHnKJgKQhoTUfXP8V8rUWzJl5GWJIyxKWqpi3tJw3UM4us7vu6XIDeeM/cU9iT DIsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=093RJ8kt; 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 i21-20020a170906a29500b0077bd009107dsi11351287ejz.714.2022.10.19.03.40.47; Wed, 19 Oct 2022 03:41:13 -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=093RJ8kt; 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 S231215AbiJSKkU (ORCPT + 99 others); Wed, 19 Oct 2022 06:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbiJSKj1 (ORCPT ); Wed, 19 Oct 2022 06:39:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD7F15627F; Wed, 19 Oct 2022 03:18:18 -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 4B89DB823C8; Wed, 19 Oct 2022 08:55:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98EB4C433D6; Wed, 19 Oct 2022 08:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169703; bh=4skOxrJgX4AfIkPHOIg87BN7DK+WMUVYiGNtnr5td+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=093RJ8ktsEQMpHiblS+LnEmpjvMXUc2QOaZ4OJ6G3IvjWvrocnaQJC7EmmapVvHPX +Fl81fWxUiRslFpOIMv2+NItddXdxH3D3QOR4LmP9k36QfYAWgW0L+56I0tjSNasqc WhSXxUrHiiNJ65DXGlMB0h3q8QDnYnQrNF8ySN2o= 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 6.0 343/862] net/ieee802154: reject zero-sized raw_sendmsg() Date: Wed, 19 Oct 2022 10:27:10 +0200 Message-Id: <20221019083305.219389595@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747112242382571222?= X-GMAIL-MSGID: =?utf-8?q?1747112242382571222?= 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);