Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1989734imm; Thu, 24 May 2018 04:07:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZquwk32vlucIr7QrOCFEVAkkF6oyXoIfwpVz9w+sfqBUXkYc1gjbymC/rLPbkHPyE1sOMHE X-Received: by 2002:a17:902:5851:: with SMTP id f17-v6mr7053965plj.32.1527160054252; Thu, 24 May 2018 04:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527160054; cv=none; d=google.com; s=arc-20160816; b=v2+jqzBMlh5G48V9gELU3/MIH1NODvT0YC2l7+o0jAqj2IQHibchzeC0lAC4Og+IWC PJFcTHe0RCLzKrk7lPh/R6DWCKQUldplOG9MJeo75QKFQP5jXv4o4WhdrkwLbswFAjRv T215P8HX537YAZwWMrh35/UhTov9qAgCD8rl6FIRiDUxy1j4RO4awxTHLY7ujWoC1ksh uKqH+V0PFkB0kmtt94y1b3lK5pdk61jgi8DBtIVKQe8nyjG1z8s973Q+rJDfLYvyhg7u hCynG64YRX6bry+Bg3iRLgXPo0oSpkFCPsSLxQ4f1qMX7wvba2o0GQVkCtWPEHPsqOpv ELHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=LnVYrzntBImcn1FOvbx+MIXh7TUkgZ6pYWw+MZ008HE=; b=ARzM/tPPv76cWsPJs5skOXbC/eP0sIb3CnoV8BZ25jYIdAn99N/cyBOBCkWIhgjI9H is7DmHITlx9TmvVjoWOGbyuH+CFPTPyH7fGoIzYpKBFLu/WCzV/oqHYDInI4BGRACuJq 7Z7QYGAvT0zPg3UJxcmsWe+MAnFdip2A3D1FTwaRNZZdBHm8tnzFiME65MzO6xwMjX1T A8Z33KVp6L0g89T5GDHgYRX4HL9TaK7gsqfKHTUVAy5AdWanX72cJUt7IjEiqEuA90Gp A5S6tLKquZDtVA/BUBlLZZkZ6yu2E9Yr1IaqRYwsW3PSkhIII29hkWA9qInqSVLCSc0k t0Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KHHHliv3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a68-v6si21730611pli.158.2018.05.24.04.07.19; Thu, 24 May 2018 04:07:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KHHHliv3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032851AbeEXLGD (ORCPT + 99 others); Thu, 24 May 2018 07:06:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:35270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968282AbeEXJzH (ORCPT ); Thu, 24 May 2018 05:55:07 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD40020893; Thu, 24 May 2018 09:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155707; bh=4qrwwgaFcBB8Iaj9PAOYJ28+ooYyCCpFIsL3D7YO1TU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KHHHliv39L2l2TSC7fa2kunTZg10n7XG6hNF128qx79RE/AW/eowKUPwYij1yZ69c yY1YKLuyIiNrsEeVIppNW6TDaGVfkFcNjmZ9ujT3ZfQm+xR2OLSNGBUbo+EI43jS+o A7YVuRzkhN8s995NP+cYOLrUZ9wk6XVACOuxmzO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Sasha Levin Subject: [PATCH 4.14 088/165] staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr Date: Thu, 24 May 2018 11:38:14 +0200 Message-Id: <20180524093625.590991506@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Colin Ian King [ Upstream commit e1a7418529e33bc4efc346324557251a16a3e79b ] Currently the allocation of priv->oldaddr is not null checked which will lead to subsequent errors when accessing priv->oldaddr. Fix this with a null pointer check and a return of -ENOMEM on allocation failure. Detected with Coccinelle: drivers/staging/rtl8192u/r8192U_core.c:1708:2-15: alloc with no test, possible model on line 1723 Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") Signed-off-by: Colin Ian King Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1702,6 +1702,8 @@ static short rtl8192_usb_initendpoints(s priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL); priv->oldaddr = kmalloc(16, GFP_KERNEL); + if (!priv->oldaddr) + return -ENOMEM; oldaddr = priv->oldaddr; align = ((long)oldaddr) & 3; if (align) {