Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp972677rda; Sun, 22 Oct 2023 19:46:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIIChFBc9UvseaR/5Ih8PlUatkZ53BhOTqbtHksgGYzyuidD8nOWKkBG7Of9cjJuekEIYA X-Received: by 2002:a05:6a20:3d02:b0:154:bfaf:a710 with SMTP id y2-20020a056a203d0200b00154bfafa710mr7003086pzi.41.1698029201839; Sun, 22 Oct 2023 19:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698029201; cv=none; d=google.com; s=arc-20160816; b=BA2PMMzU6V2IcZJqfi+24y0rAKMjvLuKvTS8PbuC4F7u1YCoQQ4NHwnl/Dxslit1Aq oMY6tty6+9WsECRkpWc1Vyg7/iLWy6oJB1q44rOyX/9+c3tvBVYIjhADWLQg8r2w6LqY SlkPQ4McgW2KsxEk8hJCe7U5h70fqU73jnN7uc40rzNXNgaqlZo/CWB6OlYoexjogtNA Y5K7vQNebZ2JHbFX3411pAL44zA/3GGPrG2bzoU5PaQ5r6dEBz5TYikfYLdz+aDUfocy B5NXDbfkNVEwhJMKfrjjqCpBR9ujBdINu182gkpB23bu4IsjC/tC2VftsVF5wLz3QnVl TLAw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HQc98ygW3JLH42W3zhpB97VN01RLRDxHg6oT7E9O25I=; fh=YY8D4Wf8JvaukQVW3d35GLT7KlLFeHE6u8vTO2Y0EhE=; b=m3uRHk0vQwQ9Lon7NEDTXJc8vcFlDOjzeMZ6G7gkB0OxcQlus0Ns6tyU1YrFv+MYy2 XacEJEBytj3q7G/E+SV26eVldUZpqec8greMHG5Youax29VoqSAanOGAybU77NsSQxbn KlHU+QyCS+rgW1zgajkW/GsSZbsqpNSylCOPq2cspEKV46d1QslbTkih8nM/q/Bupa9e 7eX6z/p5I6s17HA3pSUPBR2Udh/rEJI6Vgfj9kS2fZU1FUDHirUptf3m7gvxQPxA1l6r EZIJi9M3+0BwIwHZof4OTVoA92aQHR5vl2t8crlO1cbVkLbAiDvByMPqK2hcgQRVZYXw VL6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=H5y4JAOj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id 29-20020a17090a01dd00b0027d01d450desi5711880pjd.86.2023.10.22.19.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 19:46:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=H5y4JAOj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 5963C8065C9D; Sun, 22 Oct 2023 19:46:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233161AbjJWCqc (ORCPT + 99 others); Sun, 22 Oct 2023 22:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjJWCq3 (ORCPT ); Sun, 22 Oct 2023 22:46:29 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FAE7DB; Sun, 22 Oct 2023 19:46:28 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cacde97002so13130625ad.2; Sun, 22 Oct 2023 19:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698029187; x=1698633987; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HQc98ygW3JLH42W3zhpB97VN01RLRDxHg6oT7E9O25I=; b=H5y4JAOjGyldnWkTB5K9YPjM+gM+dlRdI98jek4ccCmB2ESWyXP5eQ27RTVCoD5IEz u+tas+VpGfQVg6+DwgQf5sEJqc5sbloAeYnlCjEnUZfWu2xyvvnxvYvWDYS/hqsbFxee vIZC67evt59ZkGyF8QtqRZYqCNHPYHhu/oRu4xjdsnBVbb/xqq84tN30S33ZGpF40HjE hjDBSpChZYvRcaDzxUOXQstEPMnGB/yK8gZxDksqg59Ax3MWcMhGF89hLUExW4+MtSCj O1RrJoCyS4U2N223BD65iTADCza7WE2um1XjOjgWf7DFeKfdPMtX6abAgS69WHyjWBbq h0RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698029187; x=1698633987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HQc98ygW3JLH42W3zhpB97VN01RLRDxHg6oT7E9O25I=; b=i5qPA2Xwvh/MbVI1T4XsZhqO4mP2375m+fLZOcQnWmgkw55rJQccydoq2kvxZsuqVN +MuHaQd3TLXmz1SKixquuxljq3xt1gqXFGUgNrPy1cCdc4Qhk9zw+N0DcRktlnNcGBrF S1ZtOyA3ujBu42RSEEXbtjf0PZebh3yGvFeDlipa7ChjO46z8l6DoyoTfZaMq0mfdFKz KYIejyKL3y++JmDvu4ZsCVZ1AdoR7RWGx+6VBe166cYQd5YED4hqWG+8ggX9Vf3lygIk vpAgSoPXA3ukIYX7TOJY9pxdl9KR97UxsHNap94NAdRVDo9HJKKALrU9L8nY3K6HP1sF 0DFA== X-Gm-Message-State: AOJu0YwB3rjzdTCd51N8B2AEOSrS9b/5IPyVK4zoR7uTubDXN4Ddedl+ G017VG5JC+UqMbUzIkwwTIjB5ta6fbgHDw== X-Received: by 2002:a17:903:22c7:b0:1ca:8e79:53af with SMTP id y7-20020a17090322c700b001ca8e7953afmr6247201plg.3.1698029187468; Sun, 22 Oct 2023 19:46:27 -0700 (PDT) Received: from pek-lxu-l1.wrs.com ([111.198.228.56]) by smtp.gmail.com with ESMTPSA id e12-20020a170902ed8c00b001ba066c589dsm5022017plj.137.2023.10.22.19.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 19:46:26 -0700 (PDT) From: Edward AD To: syzbot+9704e6f099d952508943@syzkaller.appspotmail.com Cc: davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, reibax@gmail.com, richardcochran@gmail.com, syzkaller-bugs@googlegroups.com Subject: [PATCH] ptp: ptp_read should not release queue Date: Mon, 23 Oct 2023 10:46:23 +0800 Message-ID: <20231023024622.323905-2-twuufnxlz@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <0000000000002e8d4a06085267f3@google.com> References: <0000000000002e8d4a06085267f3@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 22 Oct 2023 19:46:39 -0700 (PDT) Firstly, queue is not the memory allocated in ptp_read; Secondly, other processes may block at ptp_read and wait for conditions to be met to perform read operations. Reported-and-tested-by: syzbot+9704e6f099d952508943@syzkaller.appspotmail.com Fixes: 8f5de6fb2453 ("ptp: support multiple timestamp event readers") Signed-off-by: Edward AD --- drivers/ptp/ptp_chardev.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 282cd7d24077..27c1ef493617 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -585,7 +585,5 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags, free_event: kfree(event); exit: - if (result < 0) - ptp_release(pccontext); return result; } -- 2.25.1