From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B104235AC16 for ; Fri, 24 Apr 2026 10:01:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777024910; cv=none; b=b1BOMn5zNiSFlniqBChW2I2eU/3RWbeUt1TxBnPBNvgKABO/g9+JxT4ExXmWeLr6FOcPvqib2P1jrqvD3f0MPzPa+2/Zu9fGD1/pSO2YcdBJY+0oZV9CFG5lkKf1j9gKpk+fPRC4v3Zca+icLqsek9ga2XP5++vXZ6nARDQ5+O8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777024910; c=relaxed/simple; bh=EJuadt5p201Q50DmI7SzavMkZiJ2vuptrsOSs4YbP1Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tVkqZ97InQnI8xZjC1UMcva/7VxKps8/xO9iUzSBhKnaktwZ9gS+fUJ3BvJo4tw1sh/nd4ioFV8sMXJ2u8lE+glSXhAn1EpdRrbRFDLbL5ig7oesDwA123hAIy5iiqDYVz2kYlOwytajJZ+XDv5cCuHb1G8yxTHfhdtWxjEeh3c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XUHyI+C2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XUHyI+C2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 034C0C19425; Fri, 24 Apr 2026 10:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777024910; bh=EJuadt5p201Q50DmI7SzavMkZiJ2vuptrsOSs4YbP1Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XUHyI+C2V5n0tDeYG7xDgu3n7XgYJnUzJcKoXbwz4vIpGSUPDVBE6uDUtGft0vYkV /a2cG39eo06VNKIPZBskQ0eV39qNBR4DkzrYl4iG3ME4pVANh9Lj5Hx7ARJ/Um9+e+ oK0caa8xVJcdoDWDelEkRHq2WhHSN/QgmVfHEc3I= Date: Fri, 24 Apr 2026 12:01:48 +0200 From: Greg KH To: Hongling Zeng Cc: dpenkler@gmail.com, jkoolstra@xs4all.nl, lukeyang.dev@gmail.com, viro@zeniv.linux.org.uk, kees@kernel.org, harshit.m.mogalapalli@oracle.com, colin.i.king@gmail.com, linux-kernel@vger.kernel.org, zhongling0719@126.com Subject: Re: [PATCH] gpib: fix spectre v1 vulnerabilities in descriptor handling Message-ID: <2026042436-ditzy-unguarded-a37d@gregkh> References: <20260424095055.19353-1-zenghongling@kylinos.cn> 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: <20260424095055.19353-1-zenghongling@kylinos.cn> On Fri, Apr 24, 2026 at 05:50:55PM +0800, Hongling Zeng wrote: > smatch warnings: > drivers/gpib/common/gpib_os.c:1318 close_dev_ioctl() warn: possible > spectre second half. 'desc' > > Fix potential Spectre v1 vulnerabilities in the GPIB driver's > descriptor handling code. The issues occur when using user-controlled > handle values as array indices after bounds checking. > > Use array_index_nospec() to prevent speculative execution from > bypassing the bounds check, which could leak information via > side-channel attacks. > > Signed-off-by: Hongling Zeng > --- > drivers/gpib/common/gpib_os.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpib/common/gpib_os.c b/drivers/gpib/common/gpib_os.c > index 5909274ddc12..d4a4043b9fa0 100644 > --- a/drivers/gpib/common/gpib_os.c > +++ b/drivers/gpib/common/gpib_os.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -1313,6 +1314,8 @@ static int close_dev_ioctl(struct file *filep, struct gpib_board *board, unsigne > if (cmd.handle >= GPIB_MAX_NUM_DESCRIPTORS) > return -EINVAL; > > + cmd.handle = array_index_nospec(cmd.handle, GPIB_MAX_NUM_DESCRIPTORS); > + > mutex_lock(&file_priv->descriptors_mutex); > desc = file_priv->descriptors[cmd.handle]; > if (!desc) { > -- > 2.25.1 > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot