From patchwork Wed Oct 19 08:35:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336619wrs; Wed, 19 Oct 2022 06:47:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IghtnvgFQgSuaX5ns94NHSQNzuBqs8fhA2FtIi4WhEdG3p55h+i7S46hV8UbdYA5119Hc X-Received: by 2002:a17:903:1c2:b0:185:47ce:f4d2 with SMTP id e2-20020a17090301c200b0018547cef4d2mr8606094plh.101.1666187242062; Wed, 19 Oct 2022 06:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187242; cv=none; d=google.com; s=arc-20160816; b=ub9gTjV6EM+E+79QYK0+HBV9XVWlJqs14IDv1lDfJNJ8xxgBaAHx/VTmlh5u2+N3El Rt5nynALfkTVI1bs/NHl5JUTq5p56kPYyw408/8BNRq+8NaA/IABYrr8Xj58d3M1iOEM 2uCUPWWL1K0ymh4SR4RX4D/cKHqNRGCA09xhVmk+L3NjH/8jYW4jWaf/8NEPY07S0hJw +4qrKWRR8ITaHMQu6yJ2V3ziUjf+aR5zRPyweP+iMtabVWLyCfQfb+upjRKEOSoltRy2 0N50tzwLyTIu0BdfB3Zc7+TeSjxzYyBnDl+BP+jXC+AQ6ZSHzUvLGSW22jPEg+fizZDI vJiQ== 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=2XWnjJa5YEsFc81F+rAe2mXga1A+Lb+H/MGI5t9jqsA=; b=nPZWN0gziUEpbLQiUy5YJqMPVZsdRvKleJibXITFQ3GcfNefcAMKlWQ9a1zzLJAUqP jyHk2dZv5IJvydShmfit++tU43YqxgGlOfqADz4/hBGq+a+1/xmSUVqBSjF/nlvLP8Y+ wYvDaPhNpkHhH+HL7rJ2KrMmfuDJdUiWU2ozYs9O+lVlaGSNdZLCIY+2tHuxmziMLB7y 9iq1E9NcGvp7URZ5soHe80dSHt+vgi7vhHfvA1Smll/TgBb1X8gvmuoFQ2A8Dzbhi2fe ycaiMr3Hd7S0p6X8xc1KuX69aocyZofWp3LJEYUOa6YMkJMcvH6PwmbPyoxyViKVGMQE yYBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BJT3ECOn; 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 k126-20020a636f84000000b004402f48dee0si17903815pgc.629.2022.10.19.06.47.09; Wed, 19 Oct 2022 06:47:22 -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=BJT3ECOn; 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 S233167AbiJSNq4 (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233166AbiJSNph (ORCPT ); Wed, 19 Oct 2022 09:45:37 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19F717251E; Wed, 19 Oct 2022 06:32:08 -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 D1539CE21FC; Wed, 19 Oct 2022 09:16:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD7E6C43470; Wed, 19 Oct 2022 09:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170998; bh=ImqWgvmSAO1Y+3CZ8wtg3E3cePx97fd8Hl1xN4HzMtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJT3ECOnWvGWEQP8Ne5okuJP2agMinCoV4eOfW/uXBO3w+4m4XEvuSNZ81JGLHPVl 8F4I3HFdvobW9pLwQ4jVWzUvfWfKgtRTudSL6zgIn8MAV5HF8rNXNl3Ig75unLt2VS 1+DvVenen+vWBa6dWrVKFMBh2jwuLHmag3pIGe3U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Alexander Aring , Stefan Schmidt , Sasha Levin Subject: [PATCH 6.0 855/862] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Wed, 19 Oct 2022 10:35:42 +0200 Message-Id: <20221019083327.647551693@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?1747123953598392185?= X-GMAIL-MSGID: =?utf-8?q?1747123953598392185?= From: Tetsuo Handa [ Upstream commit b12e924a2f5b960373459c8f8a514f887adf5cac ] syzbot is hitting skb_assert_len() warning at __dev_queue_xmit() [1], for PF_IEEE802154 socket's zero-sized raw_sendmsg() request is hitting __dev_queue_xmit() with skb->len == 0. Since PF_IEEE802154 socket's zero-sized raw_sendmsg() request was able to return 0, don't call __dev_queue_xmit() if packet length is 0. ---------- #include #include int main(int argc, char *argv[]) { struct sockaddr_in addr = { .sin_family = AF_INET, .sin_addr.s_addr = htonl(INADDR_LOOPBACK) }; struct iovec iov = { }; struct msghdr hdr = { .msg_name = &addr, .msg_namelen = sizeof(addr), .msg_iov = &iov, .msg_iovlen = 1 }; sendmsg(socket(PF_IEEE802154, SOCK_RAW, 0), &hdr, 0); return 0; } ---------- Note that this might be a sign that commit fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") should be reverted, for skb->len == 0 was acceptable for at least PF_IEEE802154 socket. Link: https://syzkaller.appspot.com/bug?extid=5ea725c25d06fb9114c4 [1] Reported-by: syzbot Fixes: fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") Signed-off-by: Tetsuo Handa Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20221005014750.3685555-2-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -272,6 +272,10 @@ static int raw_sendmsg(struct sock *sk, err = -EMSGSIZE; goto out_dev; } + if (!size) { + err = 0; + goto out_dev; + } hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom;