Received: by 10.213.65.68 with SMTP id h4csp243086imn; Fri, 23 Mar 2018 03:45:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELt2Tx4/snoxFiKyo868TNSngc+43NMzOiuCXyGqg3aqYGPIfSm9rD2IP07qdUgelSBus5eX X-Received: by 2002:a17:902:5a5:: with SMTP id f34-v6mr29077400plf.288.1521801935211; Fri, 23 Mar 2018 03:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521801935; cv=none; d=google.com; s=arc-20160816; b=YBdjc+WbsKGg+5kBGKQLm9EdwshEBy/iW9ezynYg8dVulTrh3Hh3IriUeMDhjoRt66 H6jFlhWreM9Kdd3SkdU/6IP65emfjMd5FsEJeWdW5DIl4B0JRCfVoqxOG4Nn4nGAeRTg wy5H/7CL4YxwbE6GVrw6+40f9yA1iM5yRL26W7DD6A/Gf/JL648LQluGQEpMZ/2PNIOi CsesYmW4noZVGuLY3fyzNin8uwB+xg7z2i4VL2Qq2hBw0tl/eFVEOLXo+oezIRdpVEqF zoxAEln9w7ocmHCreqS+TWYvjmNRefRdTN6LKZnTJqlHlKWKMHgNWMrT6yrizNAXo7m7 j18g== 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 :arc-authentication-results; bh=bRPmjbtaAqDRpTKEOQ4TL2Rtkt0nCQyzAYZQ0vFgHFc=; b=o6fWmJu5RlswYqBcMSyaHzb6SHQxmeWZFRGefzoKTSTSqZLZyKbGJ7zkQSzsNoFLFn V3WgfKqrznjbVs2dARL8BPpL6wzsM3WMs1c2Ga80x5hLxCemECA4dc5+qZy5vJO+l02o crL0aN+WsXIoXQAH1ncw8+j5dMmEX3dax5JZsff2Zj5cuX2HEzw4S6tS+sMePF9Dr2hz ELBB5+vbz8a4qFFXkSWOkmXaaDKfsCybyaFzI1QyQit57qZbAdMQMS4z4l4XGuhi/dgd BNUcYa2pVmWh7mzxvx8VsTOQpE1W5WalNaO079rei9XPZo2YTaf+s2Cl/7xsI8fSlv5W FRAQ== ARC-Authentication-Results: i=1; mx.google.com; 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 u25si6531601pfm.164.2018.03.23.03.45.20; Fri, 23 Mar 2018 03:45:35 -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; 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 S1752186AbeCWKo0 (ORCPT + 99 others); Fri, 23 Mar 2018 06:44:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46478 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933546AbeCWKPw (ORCPT ); Fri, 23 Mar 2018 06:15:52 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CB461955; Fri, 23 Mar 2018 10:15:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Sasha Levin Subject: [PATCH 4.4 54/97] staging: wilc1000: fix unchecked return value Date: Fri, 23 Mar 2018 10:54:41 +0100 Message-Id: <20180323094200.696341654@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pan Bian [ Upstream commit 9e96652756ad647b7bcc03cb99ffc9756d7b5f93 ] Function dev_alloc_skb() will return a NULL pointer if there is no enough memory. However, in function WILC_WFI_mon_xmit(), its return value is used without validation. This may result in a bad memory access bug. This patch fixes the bug. Signed-off-by: Pan Bian Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_mon.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -251,6 +251,8 @@ static netdev_tx_t WILC_WFI_mon_xmit(str if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6)))) { skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr)); + if (!skb2) + return -ENOMEM; memcpy(skb_put(skb2, skb->len), skb->data, skb->len);