Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3528094pxf; Mon, 15 Mar 2021 11:33:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxggQ6JVw5dn78xzFdhe0tz0bDDVlmq8eXZarmTn7svspGpZ/AZWYcEfoVjR5ETkSxCUzXf X-Received: by 2002:a17:906:e16:: with SMTP id l22mr25082908eji.173.1615833212220; Mon, 15 Mar 2021 11:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833212; cv=none; d=google.com; s=arc-20160816; b=TymBoZR1+P1ujYbOs/yxIkN3YVIWPhos8/oZ2czUvV2Fw3MjbcY6IryovxZqV6v17f QdmsBCUp7/rELXLZvwR6BiPMlZ8HGgmJshrjeLLP7+qvXMktXgqV0n5zj4G3lY74teVY tIPuAyS5VTwRdJIUC6Gy0I9+quGmKqF/SwK1ACASLDz4t8yNlzF0LdHhk9x4iPY8ns+g HiCCnCAP5x3xYxq2k0Zf5pzfhHiphI+M2rFt13mrg3y5EMT41TrMW34w2+al/oumhFiQ LKJgRMylzYg+jmSvsYkxr9ZmOF/vFUZ+VbE5IVoVRcsxSzgVNsfXItcLIo6AZHOf9J9k S5lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WWezpfCr0p7ZmnirJQIt8pjaKma+j4g/8Nb0eYA55YU=; b=n6+B86Hgfj9yn+PN56mw6J0nO7vMRCChC8xxPpDLn6xAu7/KTfiYPOLLcypChk6FK+ 5SBQ7SNzt86ijrHkNnYD1jQtwXo554wMgdxTxf9R4sN0uDzpT/gt2qfW26f829yiPO12 3TED7R76Bvz7d4ZhV1o69u7vz8JpS0Z1eyo/btbJjPeiakRqNedGLISeiTLpCn7q2p9h yHhA7zhgHlOftBYm/RMMwwtczoCNlKsNvNPOrz8AS19cE0krtetPuKKroLCVMjfX2+PY QLACQu9eim/J5mcTlYhB5zmP2rT5grAyncLsb1lpfpeX4G7HW580akDqjshiDVgWJwF8 sgQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gw4g7wGf; 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 bi6si12338508edb.419.2021.03.15.11.33.10; Mon, 15 Mar 2021 11:33:32 -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=gw4g7wGf; 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 S236622AbhCOOkN (ORCPT + 99 others); Mon, 15 Mar 2021 10:40:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:49092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233805AbhCOOC2 (ORCPT ); Mon, 15 Mar 2021 10:02:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9A6D464EED; Mon, 15 Mar 2021 14:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816948; bh=0NRsVrDE7EWtRcFT0zTAxJTNzb7xxXoAYVoQRkYqv7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gw4g7wGfXzoNe3PEvDoM+LF7I9ClVS9PhXa5Y1eJ0sAlDW8/z+/RDc17ZtBC1+yZf iZSi5qkAVOVYf7u2Oy+KaS2YZz6o0H35LhvnZbG76CtQqR+0XLB80nlHFr0tG7Bm2q iHPjweOQIoXM1uoZ9xUv5Ail7cN9xr28iMOizLg0= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter Subject: [PATCH 5.11 221/306] staging: rtl8192u: fix ->ssid overflow in r8192_wx_set_scan() Date: Mon, 15 Mar 2021 14:54:44 +0100 Message-Id: <20210315135515.088478818@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Dan Carpenter commit 87107518d7a93fec6cdb2559588862afeee800fb upstream. We need to cap len at IW_ESSID_MAX_SIZE (32) to avoid memory corruption. This can be controlled by the user via the ioctl. Fixes: 5f53d8ca3d5d ("Staging: add rtl8192SU wireless usb driver") Signed-off-by: Dan Carpenter Cc: stable Link: https://lore.kernel.org/r/YEHoAWMOSZBUw91F@mwanda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_wx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -331,8 +331,10 @@ static int r8192_wx_set_scan(struct net_ struct iw_scan_req *req = (struct iw_scan_req *)b; if (req->essid_len) { - ieee->current_network.ssid_len = req->essid_len; - memcpy(ieee->current_network.ssid, req->essid, req->essid_len); + int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE); + + ieee->current_network.ssid_len = len; + memcpy(ieee->current_network.ssid, req->essid, len); } }