Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2514669pxb; Tue, 24 Aug 2021 00:30:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9x1vrPbjG1/evhgNcRpXwLFFfZEIfLPLKl+QfsrhuCCh3qHMZqDNzIj4BeCI63pBLkOSz X-Received: by 2002:a92:740f:: with SMTP id p15mr23236521ilc.181.1629790224423; Tue, 24 Aug 2021 00:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629790224; cv=none; d=google.com; s=arc-20160816; b=W1bzGul/WVnmyzW+V4uNumoNxi0KLC/w0a3y2HyjRWLcOza5Kmm94g1e9WxKyzjN/j kYjtRhyTZTcKbuBPRjFeZc2JOSRu++CWY+gyvFONxihcUppfhdsUfMcIL+AaHdkzaa01 ZdSo/QdikwL8pGKbXRAR12/VS+eOWouwWWVV43LAQuGyM5M+VPhcMguCgwU+9OLnPmXo 9ZLu7XV4Uz+qd1a2pWoStu5KzoZhlv2haTXi/Wd0fAQ2Ia6fllspFeTLwkdYTqw+TNi+ VqGQXk5UEaff9zTHlhPK3HJdxExO+9BeM83uI6Xe1jTg39rDXZbI+MkCC9ElYHPMh8tE cDBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ozZbd2WeeyHd4DiM+yD82u0jIhrxJK8GkPQjRLn2MbY=; b=Jq+QToCwuSNHPx3hOKzoj1igZPdbhvlKHqRNsMOOjAxLS1/r8X5G1frdBgR9OZIoHC LHLUHBMK6Bz3F6OpJX2eRM2Or0Tblgt1LdntgJfUHxpRuJcwIqvadFz38ZcMZQJyoknf zl/0ULRL9MEbfWwqj9Xrmtai6f0IHnD/Kr1pyiQZPZeLfVsIyW0QNVTpFUz8lnIAQj5E NBoBubzQUH4jsJZFuyTkHtoLdjeZ43nKwBaBomhOMsz4xhi9rF4JsvqEhzixxnQwt/fU NWu5L8oZriz8F5mNyKWyJ2BGV2fKtXlURSj+fmkNLVAS0HGSA3S7kg1DAXTRAHBg9zXL y2RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T7LaUs3Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n3si17977755ioh.98.2021.08.24.00.30.13; Tue, 24 Aug 2021 00:30:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T7LaUs3Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235015AbhHXH3D (ORCPT + 99 others); Tue, 24 Aug 2021 03:29:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:53286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234954AbhHXH27 (ORCPT ); Tue, 24 Aug 2021 03:28:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9D0E7611AF; Tue, 24 Aug 2021 07:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1629790093; bh=v3V3gtIfdXypMfJxsPR2tdERiRsNvF4tzk2w1+WRlc4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T7LaUs3QPTbubiICdPERyGAd0OnAqhLgp1SJB6hPNnWUNnfsSpaAwDzfyvWWxENQg wCrqmSyvOUHynhMjH2mwJnKHI5yxwck829XuwrvdPCL14L4acnq9nto+4SR/85C3YD h+FyRxLgcWVPU1ZCE72lXY9Qhfs1TmSSqdSQyAbg= Date: Tue, 24 Aug 2021 09:28:09 +0200 From: Greg KH To: iLifetruth Cc: Fabio Aiuto , ross.schm.dev@gmail.com, marcocesati@gmail.com, insafonov@gmail.com, linux-kernel@vger.kernel.org, Qiang Liu , yajin@vm-kernel.org Subject: Re: staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs Message-ID: References: <20210823170624.GA1420@agape.jhs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 24, 2021 at 03:04:04PM +0800, iLifetruth wrote: > Here are the fixes and the contents of the patch file we suggest. > > [PATCH]staging: rtl8723bs: prevent ->ssid overflow in rtw_wx_set_scan() > > This fixing patch is ported from the upstream commit > 74b6b20df8cf(staging: rtl8188eu: prevent ->ssid overflow in > rtw_wx_set_scan()) which fixes on another driver numbered rtl8188eu. > This code has a check to prevent read overflow but it needs another > check to prevent writing beyond the end of the ->ssid[] array in > driver rtl8723bs. > > --- > drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c > b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c > index f95000df8942..3b859b71bf43 100644 > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c > @@ -1222,9 +1222,9 @@ static int rtw_wx_set_scan(struct net_device > *dev, struct iw_request_info *a, > > sec_len = *(pos++); len -= 1; > > - if (sec_len > 0 && sec_len <= len) { > + if (sec_len > 0 && sec_len <= len && > sec_len<= 32) { > ssid[ssid_index].SsidLength = sec_len; > - memcpy(ssid[ssid_index].Ssid, > pos, ssid[ssid_index].SsidLength); > + memcpy(ssid[ssid_index].Ssid, > pos, sec_len); > ssid_index++; > } > > -- 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: - Your patch is malformed (tabs converted to spaces, linewrapped, etc.) and can not be applied. Please read the file, Documentation/email-clients.txt in order to fix this. - Your patch does not have a Signed-off-by: line. Please read the kernel file, Documentation/SubmittingPatches and resend it after adding that line. Note, the line needs to be in the body of the email, before the patch, not at the bottom of the patch or in the email signature. - You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. - You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like. - It looks like you did not use your "real" name for the patch on either the Signed-off-by: line, or the From: line (both of which have to match). Please read the kernel file, Documentation/SubmittingPatches for how to do this correctly. 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