From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 1BA8D3904FD for ; Thu, 22 Jan 2026 05:57:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769061480; cv=none; b=Fd+PJuxNT4yW6Wm8cZkNe8ktOhoraMqDshxt83W+zdd8MHAR4vboDYgAIZpNhcjtXLXPv0GL8HcH5ZI5NI79cjBW+9ejUuRhWqffji9HYCElzcGgxLz2OXcUGoi1sZhXDvvTXRbX1r9vd1zEWIS4oR8Kv7c+rFRaB49xsYj1D3I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769061480; c=relaxed/simple; bh=AeiDLSUWKCvYC3HchANUIctJW+gnKkwCdMRkVrhBQQo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QPqtY/lIUuWbqk3HM7GvSrcGE4I+ll2IDG2frceEZ7orHFrvfKfjuGCfE2JIbcW/GMLMJEjwiKjeSDLNwZREeIoNx8og/Wa5Ql03MwvhDBDqXDy7A+Z7ggGY1bDs9NsrGf/5dEW5DIyWYKOnrAIrAVQGeHs2aDTJG2fbQ0CwS3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OQoDeobf; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OQoDeobf" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-47ee76e8656so7555735e9.0 for ; Wed, 21 Jan 2026 21:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769061476; x=1769666276; 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=j62zNg0FbK4iuXSa0zlFDS7DWnoWxhzLXUjr8M2qWMw=; b=OQoDeobfd+AAMIaQeCM9z9zfytMRb3xsKf0A75lhECb7Vicm3W9uB754K3Un1xI/Z8 b9DmL0ZkuKtQQacxBfYxD6TB5Sey1n1Dw3HOMrHzk6y/bwLwMT6NObXQ5LI1GsW2GB04 iLRiETdXy2rI8UE1et7KPazAdt2V6Qgiq3bZhXWiggE8/3fdMxIiOM1xDF4c5TXZzCWF BSpZBx1DW2aMUFlQeINsKjDKyXfYb5fMgLuYewD9wtVOAUgYtbQJkPc4UdvLoPs/p6b7 A9KuA6LiUlq543+WnVCsRInFpSQw4+vv1ae2TDAIAi0VLjf2oM39EQvzaOLEu1rIQNFY /MYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769061476; x=1769666276; 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=j62zNg0FbK4iuXSa0zlFDS7DWnoWxhzLXUjr8M2qWMw=; b=OYIEDWW7HYaxM3Vmcw1AE3iWIBUeq0WIer4tUvvYtrSofWsHo25i1haCKPzsO2WpaR Hha1y3SC3MKm7ZnsWAYo9Q2f7R9ICY5+uDbc+h7aV6OcIKaBhdPDEW2/H6VsqQ/hA/d7 UCBaLDZvK2E3/B4wA9Fel5i/icc6mKVNiQ5L/+PL92d3IbuTHegvzER0/cuUl03mCyH4 9PtXoK/dsKDUOPxZHEegTjZgsDA1yWMZl9F8ETu2VfXW9xf95z4SWtW7FZK603Sfqq2u GfU5gv3jDvHtrvC9xVZ8pNN3nxkw8cEV6JYDNZx+ftbGQ8ierqxLNLadgUGTnSIAXOw3 VjjA== X-Forwarded-Encrypted: i=1; AJvYcCXsBtF0NcFgOK2rzMwMtDNT8X/n0UmBqoC9KI5faHakZKTzoHAHw7ccIbJTEsXRDsusMUg55I7oKuIowxo=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6vdVNgXYlafHByuDj5sDg5aGLUC9xbjB5T/WVKBear3hwuXBj mypiPXT2niBPUO/Wrurq7EN61zrx80yaCx0M5hmn4UMkGUEkwvE2VEWk8QP5IqlfMO0= X-Gm-Gg: AZuq6aIZzGP9ymi2z3W0cwNO4RN37eHN33L2h1d9WmMh7l2XpkDpUeVeWUl7a8ACX3Q bi5FCX/FKmpJCgs7D2sb5Pey+TviKY/1WEp0wNEJ9uU/gXH/dzEeZl/Sfl5XiST1zDUe0QgnasL o3UUsrjctMBbotNEkX+FU+HKJTOEdOMVz9Sv6z6gHe9+yBxKcy5sof6MzkBst5M4OpMZl/VE9GC /OFYkMFxlakxcyzDf3R+Qw5R2Mes3ksd2CEYSefWS3W1DiQee9HT7t9omlGyh9/ranmWZZxJUWs 3B2HxVZs6UXrcFoApYaUW4QhV7Zeo3lgZaeUQSoazv6g05bOOTm0UZG5oIi5S39U13jmmchpOKD 6/5br73M4Iem8C9qGWl7QRXnHflWZ9/r0Cu8+O8rxBtwFiJIBgKQTARdslDv+lpc+XIa5l6vBe/ HzFi88OD2AtN0wMDm/ X-Received: by 2002:a05:600c:1c0f:b0:477:9986:5e6b with SMTP id 5b1f17b1804b1-480416867bemr87816905e9.28.1769061476342; Wed, 21 Jan 2026 21:57:56 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48042b806besm44892735e9.2.2026.01.21.21.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 21:57:55 -0800 (PST) Date: Thu, 22 Jan 2026 08:57:53 +0300 From: Dan Carpenter To: Minu Jin Cc: gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, abrahamadekunle50@gmail.com, zxcv2569763104@gmail.com, milospuric856@gmail.com, karanja99erick@gmail.com, weibu@redadmin.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 3/3] staging: rtl8723bs: prevent partial reads in _rtw_pktfile_read Message-ID: References: <20260122041450.2325560-1-s9430939@naver.com> <20260122041450.2325560-4-s9430939@naver.com> 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: <20260122041450.2325560-4-s9430939@naver.com> On Thu, Jan 22, 2026 at 01:14:50PM +0900, Minu Jin wrote: > The current implementation of _rtw_pktfile_read() allows reading less > data than requested if there isn't enough data remaining. > > This is problematic because callers usually request a fixed size (like > a header size) and expect that full amount. Reading only part of the > data means the caller gets incomplete information, which can lead to > errors in packet processing. > > To fix this, update the function to: > 1. Return -EINVAL if the remaining data is smaller than the requested > length. > 2. Check the return value of skb_copy_bits() and propagate errors. > 3. Only update the internal pointers (cur_addr, pkt_len) if the read > is fully successful. > > Callers have already been updated in previous patches to handle these > negative error codes. > > Signed-off-by: Minu Jin > --- > drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c > index ea54a573e025..72cf8cd5f7c6 100644 > --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c > +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c > @@ -23,21 +23,20 @@ void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile) > > int _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, unsigned int rlen) > { > - unsigned int len; > int ret; > > - len = rtw_remainder_len(pfile); > - len = (rlen > len) ? len : rlen; The rest of this looks okay. But just drop patch 1 since you delete the len variable in the end anyway. Leave the type alone and leave the whitespace alone. Your subjects are too vague. patch 1: update _rtw_pktfile_read() to return error codes patch 2: clean up _rtw_pktfile_read() regards, dan carpenter