From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 6FA8839BFFC for ; Wed, 1 Jul 2026 18:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782931680; cv=none; b=mNK0So4+z0LHOjJ1AhORX8bMFm4zePJZCYz+k4oGiwGiJIoV9Vtc0XuumzIAEDABQ0mpgkQX3aqeQaEb7JD/8t04ZN+jgwH4avpL7dFeW02U4mxSbkPghyg3wpFLrFBV3jyGZyfI7s3nrD/YpjXeOeNLbh9OkMABnyXStFPqxmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782931680; c=relaxed/simple; bh=BE/f/1rXvLInz3pmufr5ci/5WEk2/qxHD9OgDxPPvI4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Tsn43024X2JYqAZp+H5xb3f5RLImTipfX5P0WNMH/6V8zO6rH7HDnavHhvnnCFwh5HVRZLrb/fMS/h7sG9yfg2d8A8nfFTmeOk+6XmT4jzfwxQGgvrjCinLiZNy+DxwogZ9ZhgcB6WnZ4PXwe6o7a8CcauE6gvEF0dzjJEC4K6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=X7/VOqqi; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=AzpQDeBp; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="X7/VOqqi"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="AzpQDeBp" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 661GmxF71711033 for ; Wed, 1 Jul 2026 18:47:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 85Js3m9pm0S9QHIZ/FB4kgJE/3jd/T/kYM2D4Xv+89A=; b=X7/VOqqiKKBpJlMX hQOwYUUN852+/C5TBC/DFtAzzOMDdgwLi+kcbNM+9ZQpoiABJNxYEACfh99uJzps M2ZhOlL2QPUTFBOoVFwxq5oQyIURS1nsOpsxOZ0StsKbchxwdLdwtDi0d9bd2WRc GUMR3FbMJx/Mmb/AjvsQ64u/JZhxG3TZZBIVmoEMZjjh/m+oIm+M9Qg+rSHjroSL KZHDU5GSx3x5T5KnVPZiRe8+cNjbVUz0UCj+X17Rc3rN2rW9i4Z60Et4I3Y0iw4v vH1Ugrj6B4M7f6Pxvldxe2kZluyTQ+TZ0Foawcx9hYe5WOFrvjBc8DP0oHK3ZEFq YxSHJw== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4f56gprj0k-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 01 Jul 2026 18:47:55 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-37e24235ce1so1317405a91.0 for ; Wed, 01 Jul 2026 11:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1782931675; x=1783536475; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=85Js3m9pm0S9QHIZ/FB4kgJE/3jd/T/kYM2D4Xv+89A=; b=AzpQDeBpOOReLN2eWkKL32qv6jTMJNuZUkBmMVafknPNTmgTpxgn98xbgh/Xx72s17 k45UfKj5p7D23/jDnY6l5pgJeSj5JSN2BaGzFCEsfYEY8+ROIHdg1Bhm8YQUjtICvFma Q+PI7B33UhTh5l3rrzwG9xXmyjQr1Bi/YZyxjVYEpo1tDStBNZkxN7ZNetIsTIB8BO5V xQ2MGI+SXyzVR08Jsu0/1z2jBssxYPj/hMx1/8DOcxtl1qiQ9yqnj9AJ1cA2eGkgP/L2 ZGnI/bb2ZBj3ita9cQnXMxamR9Wfan9/Gtk03RL1RKPhXSMlAXdubs6fs37WUSe5ug6S 8yKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782931675; x=1783536475; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=85Js3m9pm0S9QHIZ/FB4kgJE/3jd/T/kYM2D4Xv+89A=; b=knwjr1kNaOTC0GqeRuOaS3rfj0i/zLd+7WygIRo0R4hrGIJ5JvFlXXy02idk3oJg6V BP/TfmGhdZtWd7Z3WpKK3AFALfdc/yjea9Db7Q6MBDFpjwVGflrRHyOTwdO0pHWoPLa9 tSsDKz486RwbPlvUUloBTjzLmZLTI+ZaeTdjpuoCu0nlXPFxP9/0XOdZHDy+np1XyngQ aFrPF/9fCVxxRUcdwRx6c6RwoqRr6PY8KrmGH9XyhE2cff5WLTiSAQKSzXC2JCcop/lT QYlyGRImrcHmIfaINED0wLqv9+4EJ7kYLCzbgEoEMLmj85LskLIGc7ZO4MIdTjaKAgIx K1Dg== X-Forwarded-Encrypted: i=1; AHgh+RqK6RkDXOUV41Z4MKx7wcmWCyLKPNTL8nqDScqAoA+tD4P0E4AfiPsyxH4moFKlCDaCvhJyiIiumDOw9uU=@vger.kernel.org X-Gm-Message-State: AOJu0YxsLBkhdz1Yhf1gdK/5MD+d+vv2Dfw8JEPflSoGhcXdQ8MyEy1A Ds97i9R3LuUVyPEO+ct2LJlhzviEc+DhLTmJK2v/9ubYHpKAbjC9zVAQTM5BpTx2Zi1dfcP5Hd5 l/9LS+yaeMnrjg+2BmlHP0h3wkGSYBkbvr0o088NfSfbmWrkOaJbQQyk6lejsxo5nbkw= X-Gm-Gg: AfdE7ckk52AwOHFxAjpWFUSzkbD8qJWX7H3VA3WzADJNjcEQkuesRllrnJApHZM8d8W 800y+gAAuYVb8SjGvkDD60JhzQBNuWAa17sn2K+b1vROVPMkxoGG0gYUw1z/mixg9HIt18VfS0e gwp9+Japjv2LPV936gHxFiA8NZ7/S86fEx+6GWFPqavnzOAi9rigjE4NPuBaaUlduG1SGjGDsMP 835Yf1gDpmX9KOhXeFVZ8qm5i+H+sodi0LPBJSnWSJ/+/VcUyE1bsKP2PyBLZYMVnxnlgmIpzE5 OPJhGyh6z0UD99G2dZXKDwsYEL9lvcqLxLlPY+Ugz8KY64UtAwG71jYhc0efks9ZBgkMsiXU+Yl 6JvT+mRkKq+JibfPsjhfaUYhW7+24pv2nJqPXFOgqkIaCjXWrSj2Nd6D8lxXytYd+jmVVZA8= X-Received: by 2002:a17:90b:510c:b0:36d:b9c5:e8f6 with SMTP id 98e67ed59e1d1-380aa18d0a8mr2656575a91.19.1782931674742; Wed, 01 Jul 2026 11:47:54 -0700 (PDT) X-Received: by 2002:a17:90b:510c:b0:36d:b9c5:e8f6 with SMTP id 98e67ed59e1d1-380aa18d0a8mr2656538a91.19.1782931674142; Wed, 01 Jul 2026 11:47:54 -0700 (PDT) Received: from [10.227.110.203] (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-380ce0c25bdsm344196a91.12.2026.07.01.11.47.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2026 11:47:53 -0700 (PDT) Message-ID: <85a5f48a-2eba-46ec-855b-c4f7abf8e264@oss.qualcomm.com> Date: Wed, 1 Jul 2026 11:47:52 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] wifi: carl9170: fix stack-out-of-bounds in carl9170_cmd_callback To: Christian Lamparter , Deepanshu Kartikey Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+5c1ca6ccaa1215781cac@syzkaller.appspotmail.com, tristan@talencesecurity.com, TristanInSec@gmail.com References: <20260424031711.53104-1-kartikey406@gmail.com> <26e33fea-c81e-48f4-a058-4b3bf0dc95c5@gmail.com> From: Jeff Johnson Content-Language: en-US In-Reply-To: <26e33fea-c81e-48f4-a058-4b3bf0dc95c5@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Info: AW1haW4tMjYwNzAxMDIwMSBTYWx0ZWRfX+cpWfYGOQr2/ 9hSuh4qbi4MDDRVBor77p/lxgblocf1VRSbxA5/2gtYFQGd+rXXgksZQk70xQmGITt8iaBO9fpH H/3k13OJKoQSWpc+rqxK/Xn3AHi6ZwI= X-Proofpoint-GUID: yjSfH0BXL01RBmF7whh9Y4vgN3ACYgZ0 X-Proofpoint-ORIG-GUID: yjSfH0BXL01RBmF7whh9Y4vgN3ACYgZ0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzAxMDIwMSBTYWx0ZWRfX33uFToUigplv nbeeYAOaaYpXey3nFQ7AO8cMeGSkKT74xiZHN6AyoW2icafgEUu2LdCCBmKKHs2McbSGSZryeBz wWWfZQVaY6fB7DhO+DTvkbRZHZHHScFoPte17xMni+FlUJCjLh92vq4xFCXaafPIx6NLgQHH0AP XuRtrYOju134BrAIClNHzKWefBZPdke0vT12upTiUSelPHG3HzThvWsjXL+MG0F6CFcRRw+5cfd OZjBdHpmvRzhBgkRDDALK69h6d/97unvzL1WZIcuph4yijHcK7MgVHd9Q6qm8Cl0q7kwGoRMlsp xZyOCiEU6m1uVinhffHOgReeStYo71UXa6FW18965wziaui2aw5nx6fUjUabNBs2XLuVxPZZZ2Y P066HpSVKcKdXMDHvIFmyFo4E5ZXuQCpnmw+f1/vdVM/f/p1tEhdfDkx9HUbQqMHY2ek4aSehhG 6x+hppGsXNIlH4CX7Wg== X-Authority-Analysis: v=2.4 cv=K9oS2SWI c=1 sm=1 tr=0 ts=6a4560db cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=oAVE_eoOLsoIbNkDC6UA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-07-01_04,2026-06-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 adultscore=0 impostorscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607010201 On 5/1/2026 3:17 AM, Christian Lamparter wrote: > Hi, > > On 4/24/26 5:17 AM, Deepanshu Kartikey wrote: >> carl9170_cmd_callback() does not return after calling >> carl9170_restart() when an invalid command response is detected. >> This causes a fall-through into the memcpy block below, where >> ar->readbuf is written with a device-controlled length (len - 4) >> instead of the expected ar->readlen bytes. >> >> A malicious or fuzzing USB device can send an oversized response >> (e.g. 60 bytes) causing a stack-out-of-bounds write into ar->readbuf, >> as detected by KASAN. >> >> Fix this by adding a return after carl9170_restart() to match the >> original intent stated in the comment ("Do not complete"). Also cap >> the memcpy with min_t() as defense-in-depth to prevent overflow even >> if the control flow changes in future. >> >> The bug has been present since the initial driver submission in 2010. > > > I've seen this before in a mail from Tristan Madani (CC'd) on the 13th of April 2026. > Unfortunately, he didn't post this to the linux-wireless mailing-list. Instead > he went for the Security Officers , so I can't provide any link to it. > That said, he since changed it because of the notes I had about the driver actually want to process > further so only the memcpy that caused the overflow was modified with the same > "min_t(u32, len - 4, ar->readlen)" instead of "len -4" as the length: > "[PATCH v3 1/3] wifi: carl9170: bound memcpy length in cmd callback to prevent OOB read" > > https://lore.kernel.org/linux-wireless/20260421134929.325662-2-tristmd@gmail.com/ > > So, who should get the credit? Maybe another person will post a patch soon too? Who knows. My plan is to take Tristan's series once I get ACKs. Any other contributions that conflict with his will be dropped. /jeff