Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp253818lqp; Thu, 4 Apr 2024 12:06:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkqTlP90PLxY4FhzEow5YHFzoUAcrD5ptp6rQbY2EeJPmgJSCpzKAXcili3Vgy5BJRAt8CXl4qKp4QqTk+tL27MM2PuuhvMparsDf+Pg== X-Google-Smtp-Source: AGHT+IHQZa24Q2xgFlXtDkN33JY1IaVIm7lYgFRkUovfORu9SWyfqMmTW24foAFKtVI9xGYnXxjT X-Received: by 2002:a6b:7007:0:b0:7d3:4ff8:7ba6 with SMTP id l7-20020a6b7007000000b007d34ff87ba6mr880372ioc.3.1712257619498; Thu, 04 Apr 2024 12:06:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712257619; cv=pass; d=google.com; s=arc-20160816; b=Lf9JZ26KCgcS2lQuU4l7te8R8FKi2tYT17nYqdJBopuF7JOIkX1jeWyIOEt7Ey1pDu pARl1qHBP+R4/2KnWLvmw+J0mo5J6uGl2HdtM3lCC/1m0qFyoEKi/9xO9wMx+L+68qOP MLKz9/OcCviVsV+ttkMoNnriJ6ZxP8JeYLB7t2INUjqA9M5l6HSrBYeOy5zGeiiFQ2iM 5qpIsbpvc90P45pbE7FrdGAyIglNWhqb0YHPqvzCCN4eRx3EO6/Yd/xTizfnVdPbUTYC Oj0Su6NTvORFA8jpUCW+8myefnjZd9h5HV9SVdUO25sz+mIVmAyvlRGvjH0GoFUhXa1C 5e+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :from; bh=enjMn02TLD3mOlnQB3yn7S7ejIE2sr8ne5y/rmqQS0o=; fh=Iu0gHPUGmMpc+HMDaDfvLHkSpdPZSz6h94RPMtlf6l8=; b=AWqbtsRG1VzoiDIoZNZCXNu+nWPilVbyEDGkJ5maX1VFuNZd07leFyNExxrkk2WuYU 0YVMRQhGxV3Dt9rJJkmzBruI6U6b0HHuVpOYcysZ2bKAjLccD7IaB08Q3NKg6pLh9HOm sllCFNAXIJ2q04WeZsx1NF5UqT2/2wJ5W+Lo/I/kejCFncV03F/Y0Wpx9ZKaDVOt3R8I BoLRil6AbQAiP992kysVSqQ9IZCQCASY42gdmT5sVGYvONKelwqHImOjwQCYuzq2l2aj SGw3jzmQNmHcL9eFEJ7yesPGCvANUxZ6YE+YqJ4umjZJ/MO8/vJQFGZttespHVSXOXEz /DGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=D9xNsJdK; arc=pass (i=1 spf=pass spfdomain=toke.dk dkim=pass dkdomain=toke.dk dmarc=pass fromdomain=toke.dk); spf=pass (google.com: domain of linux-wireless+bounces-5878-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p14-20020a63740e000000b005dbd0d798a7si15190315pgc.558.2024.04.04.12.06.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 12:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5878-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=D9xNsJdK; arc=pass (i=1 spf=pass spfdomain=toke.dk dkim=pass dkdomain=toke.dk dmarc=pass fromdomain=toke.dk); spf=pass (google.com: domain of linux-wireless+bounces-5878-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 76888B2AB52 for ; Thu, 4 Apr 2024 18:40:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B8511311A9; Thu, 4 Apr 2024 18:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toke.dk header.i=@toke.dk header.b="D9xNsJdK" X-Original-To: linux-wireless@vger.kernel.org Received: from mail.toke.dk (mail.toke.dk [45.145.95.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DBE217997 for ; Thu, 4 Apr 2024 18:40:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.145.95.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712256046; cv=none; b=t1WPoV2rvZWZAzfl/bPRrc3nh2QVfVruNgUJwuq0VqvztrgKwcQMd6Y+pKJvf7UcXgTyAUOv6RGQgPFu1dqfRCYv6XobuoK/cQud4lLOv/CxA72gDjboynUxPdQqfKKNk/MZqpAzwtsK1YKkT4ZRub/aGf4M6dmubxVfajnKEdE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712256046; c=relaxed/simple; bh=enjMn02TLD3mOlnQB3yn7S7ejIE2sr8ne5y/rmqQS0o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=cpOAgPfbnoDUCZ8oKnwSeqVgT/zpC6Nz/TVNmBV6ErTKQEZ2IS81SiH0eNF2lkdvQjDhQmaEkwHXVvC4TUI7CQQKmr23x/bCT/Sxp+xJDXr90A4LBlHfsbC148ZaOMmETZtdjf18HwvhrWrNo4sY4X6800dAZERA85dyyxlFDcg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=toke.dk; spf=pass smtp.mailfrom=toke.dk; dkim=pass (2048-bit key) header.d=toke.dk header.i=@toke.dk header.b=D9xNsJdK; arc=none smtp.client-ip=45.145.95.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=toke.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toke.dk From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1712256037; bh=enjMn02TLD3mOlnQB3yn7S7ejIE2sr8ne5y/rmqQS0o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=D9xNsJdKKuXc5gFTSJJMIvdvNp5bNm3DTwdjoiY2alEUOebOBsttHHtOxBBw0+Wfh DNttDY0xYyXO7UwLLLrFlmXI+4P2gVFb+vNkjMoHKIDhhuccQ7pYEWLnRdJUIgQQMc t/MSYrV9Ee9hbjR1BGrMRFMA6Qof5/LriiGizL1jNa9mQrVXfJ4ZRJSFthf0pFOolq yp1Srcs4ZEiuFYtKc/ghB9pa0wRzgRhVQhW7+HbS1sUhzwJZvJ0+HnP2RrUjRgwgRm EkKvqmJRpLpo8/ruHhsk0Yn817UDQYwdofKVcrRLdXCLgJngcdq4LZjPKMNO7dB1+Y 9nWF/PKQNaN+g== To: Chien Wong , Kalle Valo Cc: linux-wireless@vger.kernel.org Subject: Re: [PATCH] wifi: ath9k_htc: drop too long USB messages In-Reply-To: <20240404150110.13816-1-m@xv97.com> References: <20240404150110.13816-1-m@xv97.com> Date: Thu, 04 Apr 2024 20:40:37 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87edblkm3e.fsf@toke.dk> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Chien Wong writes: > Currently, the length of USB messages sent from host to Wi-Fi dongle is > not checked. Without the check, we could crash the firmware. > > The length limits are determined by _HIFusb_get_max_msg_len_patch() > in the firmware code, located in k2_HIF_usb_patch.c and HIF_usb_patch.c > of the open-ath9k-htc-firmware project. The limits are 512 and 1600 > bytes for regout and Wi-Fi TX messages respectively. > I'm not sure if the firmware crash is due to buffer overflow if RXing > too long USB messages but the length limit is clear and verified. > Somebody knowing hardware internals could help. > > We should try our best not to crash the firmware. Note that setting the > MTU limit may not work: monitor interfaces will ignore the limit. > So we just drop too long messages and give warning on such events. Silently dropping packets seems like a bad idea. If needed, we can have a length check with a warning *in addition* to the MTU limit, but we should definitely disallow the MTU change first... -Toke