From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07ED82BEC2B for ; Wed, 15 Apr 2026 12:29:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776256158; cv=none; b=XYWUKpiS27x1DTUDFA8Kz2NjQQ4LpmPYBmv3u1MsH00CuH7EDjJWczmhOtNg01ltR91i8TMKr6L2UIBYc0raUAA6JGhyMKalrhH1/99/cyPyMhGlDJk0118MXVKHlbaTWc+p6pAJRTsaChTWFC2Da93X5hXUaAaU0HdbhjDpb2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776256158; c=relaxed/simple; bh=VwSycxcMvzv0AC7JXHVYs4iVgHpyetPvOhSnM1Rqphk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jWPzt0q/oyIflTGWrvSQ0sfKS6Xjin1/MOPPuO/vCC3pOhmDMrhBB9qEkOz/nEH7RMFs7am0ewVQjKENG9f7v17B3HoA+bW/zQX0t8Z3M6LAak3H6FhrUSft0lksVmLeNHBAbsVzn9jw+SpcsugKwORHlpSsCuM9OWRXqhydLNs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Tzc3OiHV; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Tzc3OiHV" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-488ba840146so66346485e9.1 for ; Wed, 15 Apr 2026 05:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776256155; x=1776860955; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xImlqYNPeJpJPui59NA6HzPPHUbHf/Rvw0mGCXMcsz8=; b=Tzc3OiHVUAGgyerrRi61Nlr7YW1F9ORxUxb0io/FeWt29nPF9OPU0iRmJ8eTrDWQSZ Ccs+FunZr8L2o69kNmNoyal9NGfloeE5kz6Vji+wb9a0YRPk94Or3N2FwfNyo5yLFqMK deNxtSLYJ9APj8ggaz608zXcj9iwAipVcH2ttNAgiKzy7/ITUhijxQReuR3ViQ76tLvN COpIgGUNls9CTSM/kD9p58XvLNNL5xeHjie3SGktjXGVxIx9dKpeeeFyQGE9s2uuOohD lv5I4DlHRW7MFrfR8R4rkCBSK4slzCl1MJps6JdlVJ6LGWC4v9oybxkLMXhvt/p8rp+l Fucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776256155; x=1776860955; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xImlqYNPeJpJPui59NA6HzPPHUbHf/Rvw0mGCXMcsz8=; b=U9joPzH1clekbMcrn2+ELXlxbcp5CirZkGNefTU0u8LCgjqaimraJ3TJ5z7K6fHxhJ 7v8K1e9dumjN+eNgNnx1WN2ArYjyxCIxZ6l8jPrYflnuKBp2NFV2FjV/i+cF0ht0NCSB 65yBuOQ8qeXy8QuhtvyRblcSEAw2OzQYigj5+17u4E54L46s/oMamCkqSWpw6GRHCqBQ HTc40ZlNYS2jK6XD5RYfcdZwybL9KWhKdGKrIBKt1HiHnuB0UhnWfPFiBCJtNTQ7SzCO My4qVWjYTA4z3Y7Lhot/Zy/jikQwDdMMT1gMSOrY8IZpfcKhQBGM2ipde8ECL4U2wQnW 8PPQ== X-Forwarded-Encrypted: i=1; AFNElJ8gKe9vOKpTSAfkfj918sM4wJvkCTpHRjgNUHAvRhk8/J7+92sFjDBQ5Xg8mRxhWg3knGsjH+wZ6C0tb2g=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8UObEFF0caRibJIfkPvZjnfqsggP1AzVGvfnshRfkqd67aNUN DvKrbI11j5Cwb9wq+PcYiMflsL6WcA9IXAoDGLRZ7vCvBFl8sKC0u4Y5 X-Gm-Gg: AeBDievv8C4JS3pGSMra/rEIm4SAd2ShsiHvJ5ol1Vl+S7xXNjT2F92/89c1JucNDdZ fO7CMrO4NWcsil2KxZTW5LCDa6rAK6cISxW0kndhW3k3j+WJBkJMswrIWcSZ3cUlS3KtbN0WSZh 1zDP6/yx+wnayV165mmATfFZykQrtcuwb89S5GaDXYFHW2jSqSxKbLTeI3Zd8EN0aBwsrfqFTb+ czi5hVrGmEFTuNRihuSjWYaM+1nTbzIpn/b78CQD1A6v12+wbKK2lNoi85SvVsruraR6wg3pwKP B8nWZIzxx7DM6+UJf7SoWnzKpobNK25NFzISLMvSUgRrU3OZNqCY4kPCOD/V85lMq0UcAC3C4mW YSPLI/mTyqQKFNkadES9suAQa8Rrpa6FhcdzV1NQS71NFEYJEw0ffjb+yCwMp8qwFSNJyw9zoVo ev2A2Vrz8lPWXggbRljMunOEKRCrI4zg== X-Received: by 2002:a05:600c:628b:b0:488:904b:f31 with SMTP id 5b1f17b1804b1-488d68603ffmr271059445e9.22.1776256155141; Wed, 15 Apr 2026 05:29:15 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43ead33d65asm4951177f8f.4.2026.04.15.05.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 05:29:13 -0700 (PDT) Date: Wed, 15 Apr 2026 15:29:10 +0300 From: Dan Carpenter To: Luka Gejak Cc: Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] staging: rtl8723bs: fix remote heap information disclosure in issue_assocreq Message-ID: References: <20260415050302.9934-1-luka.gejak@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Apr 15, 2026 at 12:55:48PM +0200, Luka Gejak wrote: > On Wed Apr 15, 2026 at 10:58 AM CEST, Dan Carpenter wrote: > > On Wed, Apr 15, 2026 at 07:03:02AM +0200, luka.gejak@linux.dev wrote: > >> From: Luka Gejak > >> > >> When building an association request frame, the driver copies the > >> ht capability ie using the attacker-controlled pIE->length from the > >> ap's beacon. If the ap provides a length greater than the size of > >> struct HT_caps_element (26 bytes), it causes an out-of-bounds read > >> of the adjacent heap memory (HT_info and network structures). > >> This uninitialized or sensitive memory is then transmitted over the air, > >> resulting in a remote heap information disclosure. > >> > >> Fix this by clamping the length passed to rtw_set_ie() to the actual > >> size of struct HT_caps_element. > >> > >> Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver") > >> Cc: stable@vger.kernel.org > >> Signed-off-by: Luka Gejak > >> --- > >> --- > >> Changes in v2: > >> - Refactored rtw_set_ie() alignment to follow "open parenthesis" style. > >> - Allowed the line length to exceed 100 characters for better readability as requested by Greg KH. > >> > >> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 +++- > >> 1 file changed, 3 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > >> index 5f00fe282d1b..08e597bc0345 100644 > >> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > >> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > >> @@ -2954,7 +2954,9 @@ void issue_assocreq(struct adapter *padapter) > >> if (padapter->mlmepriv.htpriv.ht_option) { > >> if (!(is_ap_in_tkip(padapter))) { > >> memcpy(&(pmlmeinfo->HT_caps), pIE->data, sizeof(struct HT_caps_element)); > >> - pframe = rtw_set_ie(pframe, WLAN_EID_HT_CAPABILITY, pIE->length, (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen)); > >> + pframe = rtw_set_ie(pframe, WLAN_EID_HT_CAPABILITY, > >> + min_t(uint, pIE->length, sizeof(struct HT_caps_element)), > >> + (u8 *)&pmlmeinfo->HT_caps, &pattrib->pktlen); > > > > You're being conservative and trying to work around the invalid > > pIE->length, but in the case where the original code corrupts memory, > > we're allow to just give up and return a failure. > > > > There are two other cases where we trust pIE->length in this function > > and those need to be fixed as well. > > > > regards, > > dan carpenter > > Hi Dan, > should I keep my approach as is or just return failure. I will fix other > cases as well with whatever approach you consider correct. You should return a failure. regards, dan carpenter