Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2022207imm; Thu, 24 May 2018 04:40:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpzcB6hngh8UYdQaGjAWrJa0+/Es6hWrBYdK3TYUnTdSSEsDsX2kHxByNutgz5/3aB3CH8P X-Received: by 2002:a17:902:5597:: with SMTP id g23-v6mr6965816pli.347.1527162029636; Thu, 24 May 2018 04:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527162029; cv=none; d=google.com; s=arc-20160816; b=ZjH9/p8UlKtX4zsm1LY82Hd8052HFbsJAczoWeAHNKOJsf+0Z8PCH+WgubKj9KeAje p8QACu3h2s+9l46XF6xh4SWIGKRuZVnKCsmISgkuRU7U7LussqW3Eoesk8IxMyOc6N3T lalf9DPi1KiXJSgVtLNXm2lKLuv02OSKR6LrnZ/s4hWZFXLAO6cSDt6MzDJzflUfYMZj BU/FLz0b7W2zl4D7i0GBTZkfxL153sTVu4i41ZPLjelQ0oY7We2Fhy4+AB6s34iuQlTE NLBqe4uNmeJxhDHYspQSGABxW15OCDxFustqaaCQA3G4Vu4ZKCgvvKLolo/tgvhAMt5P kC6A== 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=joUEaifgLUPro+wjDYTKoojwPRpgRgE+JbWAg8HTTtY=; b=G0o13gzz1NnJVGsdKNVq3JbHMSqHEC2sIYXGQsubjrHeO8EC1Hu6lKgk305BrcabsS U3rMXXeClcVvT09m03P+LjIyqDg50O/K+4t5fQSxTxPTZQiDcHniiSk4qGqo9ZNg3oRx eMbiOQawkU97cR3wTJG2Jsv+aS6BSImU/cMMftnpIwhIy2ZtEqfFhKoXnD7qAitEu/nw 8krrGiNiFXw4Lo2ieh7TRgn1opOCTT5EdHa1AnvsHD6GS92Ww6o321ouOXYYeDo89DSS gKuFe98X6+xTawab4dfgofDYoE2jZFj0pE1/yKC4xG7lIxGrw5pDiIHqXk1l3yyoUXw1 5EZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cXUk1pzx; 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 u68-v6si3926637pgb.553.2018.05.24.04.40.15; Thu, 24 May 2018 04:40:29 -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=cXUk1pzx; 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 S967311AbeEXJtD (ORCPT + 99 others); Thu, 24 May 2018 05:49:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:35306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966995AbeEXJsz (ORCPT ); Thu, 24 May 2018 05:48:55 -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 2D09D208B1; Thu, 24 May 2018 09:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155334; bh=aSnXv7Zc+4TbYGquP0I0hp0hnYPxcVj99s+mO3krPKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXUk1pzxMojnjCG4hJnlt+8CCgN9AZnqAFsKMYXSCNoAH4v+714NtPoH0GGsEJsxp VZgu8HjEHGEpQ/SqoxY2eYs+Bfdwo4MpK+xXmSPT01q8DuBeC4oaoBIqaZENJRVXM8 ddOPgYa1PJzQS6v8kVNSXAf80nVWeH1ZtsvH6v4U= 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.9 48/96] staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr Date: Thu, 24 May 2018 11:38:31 +0200 Message-Id: <20180524093608.243563919@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@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.9-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 @@ -1705,6 +1705,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) {