From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 4E3A13783B8 for ; Thu, 29 Jan 2026 07:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769670309; cv=none; b=cUraAD5MeDJc+uACQGhFRzz/LH5SGSiyRFtOKTJu9e1u77QId53Uykw1ylR//WoHTlDgobMDb6RnqFOH8BkXYEom/k1u+rBucQIETn3j11JlH9jhkiOzRJctpU4BPKNWphrHu8PUmVIca+mdB3/HqFqLYOrr+bq/hvwFu8r7zX0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769670309; c=relaxed/simple; bh=7cD6sv+qqmtIcQeBUVJ/3S1WxJ7raHe5Ra0m3TKuxcA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BKc+lXiblYjlGrvNz/uW0WVCeYF9pq47w+HgJDRvE8LoAtXD86gk9i5ORmTYrq9H4RTxl5U8En99sIIXdNfxRr/EsQlgf4h7KO/3EySyxgDclCbqBX0QQVU2B9DvJkkbSVdzNBGjr/VBXt6dBnCCaYwmeT1CPUcjI6FvGtt8AFM= 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=nJjwYum9; arc=none smtp.client-ip=209.85.128.54 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="nJjwYum9" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4806b43beb6so4606825e9.3 for ; Wed, 28 Jan 2026 23:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769670307; x=1770275107; 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=9iZOKKqf6KRyH3Q53I5mI3DNCz1MvvDltctEiG+6tBo=; b=nJjwYum9UqZWmad/AJTYhXx8uf0VHpgHHKjCN5hE1agAaCYrKZnyy8s3JC0J6hFyE+ cBB7y+9WgvMWEOLAQpignNvZVzZQ6SEI56SuUgu2YlX3YrHjwjdqxBT4Y7YI6Yr/1AUO nVoa+dOBXzGk3j9BWNwwAi1K90ViMrvyJRs13lfA8goOKtCCmLDQkMZzWAyk30Ofr9lK Ok7L7A7rNNVw/Ir5VpXh5d2xNE0KjSB7McmIknms2xb/9TMS7Idv1dXdd9i6L7p5q85/ +lGpAWH3hYgEsjxzHIqNdJDMgj5zeI8bhhZb+4o4uEixbYcnVW9wasD2vyYgH8vuITf6 SCoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769670307; x=1770275107; 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=9iZOKKqf6KRyH3Q53I5mI3DNCz1MvvDltctEiG+6tBo=; b=A5aOZWXLGJvLGAjQJ+dXWkOi/cOPRpFAGvdp/p4WfOwrB0Dnib17TwELk4cWKHuUJn I825u+AuIOdWNG+BwrirweugDUopL9USPnqNHOPfnUdecJi8cMHkonJHHNk3xiiw6eGc fIGqUspJqakOuEfBvyfEsHWAIkZOzqaS6hmmG8n2MAqwXrm/NAbVwqt6lzWJfcEO7N31 x+erTlhTlo88sssEl+Le9hisIAmMhYkF36yYn3o0MX8Y/bPQQUPaTFmb956FjIIKzytS hKL+2EGEHFDTIz3SphY5EpgNb2JacpbQzhvobY+SqS3Jh7MSRVAxttKEsChIpUs8rK4G 4U4Q== X-Forwarded-Encrypted: i=1; AJvYcCUbCQ8M66Pr7VlcWCMlUAPs5OfsZc+YZyUnyUmVf5VMeCcR0akV4LErL3PNG1yWPKH+DJF5YNKIrYm24nw=@vger.kernel.org X-Gm-Message-State: AOJu0Yzqddvg+m7VG5OLoPHUwoYMJtJW6ganOH4cfiJ+5bK35K38MzQt bbWJFivdI+APM6y+o63L3CRn+v49TrFJM/Y9dpiyU3LoD7o1UWYGGXPmLiM0oIcj6eg= X-Gm-Gg: AZuq6aKPgiFhzYJweS4VPiasJyVnZqQeGi9U30jDRyCrA3gsHGbqx/7/pPYwcAWeuYv gNdlMKF0rRsF1cTLbAbSmpQK3GEJCkghs5355c0XiCGU/HDZRqD6yo+M1FT/NW2mbNe26sxCB3o +hrI4d1PW29EL+ayBE65VDrEAY6x9CTe6n/9B79QO53tL2yZPfNzossBx6n7mAf7hIt0Jbljf09 gt5/eB0K9jb+VlL5Yf1yNlCKhGYR2eefvThM0UacE47RDLOkBqbsd/2rXduhjXe1iqQIZ9NVo/k LYgMR+UzU35osdC9ncYAjNloyY0pv8vTAHb+wh8HHr6aSaI2oMuJ4QxfMpT9EXuWQgU5ITNJNFb 45+pjrD8JHiJjyRSa44nvf4+SHSzwNte+LNT+VXkmAChKCX9gMFaKp4i59vjb4sRw4vE7AvsR36 Sv1B1oGF9F4907Idx6 X-Received: by 2002:a05:600c:6748:b0:47e:e970:cf28 with SMTP id 5b1f17b1804b1-48069c60743mr98052085e9.30.1769670306620; Wed, 28 Jan 2026 23:05:06 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4806cde00e8sm115306305e9.6.2026.01.28.23.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 23:05:06 -0800 (PST) Date: Thu, 29 Jan 2026 10:05:02 +0300 From: Dan Carpenter To: Minu Jin Cc: gregkh@linuxfoundation.org, bqn9090@gmail.com, abrahamadekunle50@gmail.com, straube.linux@gmail.com, bryant.boatright@proton.me, davidzalman.101@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging: rtl8723bs: Fix potential race in expire_timeout_chk Message-ID: References: <20260129023214.1149822-1-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: <20260129023214.1149822-1-s9430939@naver.com> On Thu, Jan 29, 2026 at 11:32:14AM +0900, Minu Jin wrote: > The expire_timeout_chk function currently do lock and unlock inside the > loop before calling rtw_free_stainfo(). > > This can be risky as the list might be changed > when the lock is briefly released. > > To fix this, move expired sta_info entries into a local free_list while > holding the lock, and then perform the actual freeing after the lock is > released. > > Signed-off-by: Minu Jin > --- > Changes in v2: > - Use LIST_HEAD for init list (suggested by Dan Carpenter) > - Replace list_for_each_safe with list_for_each_entry_safe > - Clean up unused variable 'plist' and fix type of 'tmp' iterator. > - Remove redundant "free free_list" comment. Sorry, you have gone overboard this time. I only wanted you to clean up the new code which you introduced in the patch. Please don't clean up the existing code in bugfix patch. If you want to do that, it has to be done separately. > > drivers/staging/rtl8723bs/core/rtw_ap.c | 27 ++++++++++++------------- > 1 file changed, 13 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c > index 67197c7d4a4d..d0a26134b67d 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_ap.c > +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c > @@ -172,45 +172,44 @@ static u8 chk_sta_is_alive(struct sta_info *psta) > > void expire_timeout_chk(struct adapter *padapter) > { > - struct list_head *phead, *plist, *tmp; > + struct list_head *phead; > u8 updated = false; > - struct sta_info *psta = NULL; > + struct sta_info *psta = NULL, *tmp; > struct sta_priv *pstapriv = &padapter->stapriv; > u8 chk_alive_num = 0; > char chk_alive_list[NUM_STA]; > int i; > > + LIST_HEAD(free_list); Delete the blank line before "LIST_HEAD(free_list);" Don't put a blank line in the declaration block. regards, dan carpenter