From patchwork Mon Nov 23 12:32:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7680851 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B2AECC05CA for ; Mon, 23 Nov 2015 12:32:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2C192068D for ; Mon, 23 Nov 2015 12:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF834206DB for ; Mon, 23 Nov 2015 12:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751730AbbKWMcM (ORCPT ); Mon, 23 Nov 2015 07:32:12 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:35169 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751419AbbKWMcK (ORCPT ); Mon, 23 Nov 2015 07:32:10 -0500 Received: by pacej9 with SMTP id ej9so189959262pac.2; Mon, 23 Nov 2015 04:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=oM4uHvAYpXZL6+Z+oMOEMLeieJUyIKmDWdmOiSRH624=; b=uz7cSXzxKqoAefQ1ryXtdPGjS3dsMz7D6dLMGXypNjzNVFZF8MQy6XsxAYf9gNJ7jk 8CN9POjnGfxpc9d78Tdz9zk8OVLPwlxU3bGJLN/hK18MGPbeZx5BNzLzWL/g48hBmgQ5 SSboMJGlt+kHfh6/L0l3vJ7zmxczZ2/kqi+FK+0SAqWJpwY7vblArSLdkT2nhob0UnNW r0KmwVp/eSm/5D3896A5eIecg5Q1pEm09w+DGmNZ8jotgc5A6J3aDPQO/ALz88uwQb6+ OUpioaaNCKw20gXyN6oN4RHtmstMQ/hnZXQ7J88sY1Yc0xm3/t5+FtpT4moXy2a78mjo WovQ== X-Received: by 10.98.65.2 with SMTP id o2mr15466588pfa.99.1448281930153; Mon, 23 Nov 2015 04:32:10 -0800 (PST) Received: from sudip-pc.vectortproxy.org ([122.169.181.80]) by smtp.gmail.com with ESMTPSA id qj4sm3795648pbc.21.2015.11.23.04.32.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 04:32:09 -0800 (PST) From: Sudip Mukherjee To: Kalle Valo Cc: linux-kernel@vger.kernel.org, libertas-dev@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] libertas: fix possible NULL dereference Date: Mon, 23 Nov 2015 18:02:02 +0530 Message-Id: <1448281922-20382-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We were dereferencing cmd first and checking for NULL later. Lets first check for NULL. Signed-off-by: Sudip Mukherjee --- drivers/net/wireless/marvell/libertas/cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c index 8317afd..e38ad1d 100644 --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c @@ -1108,7 +1108,7 @@ static int lbs_associate(struct lbs_private *priv, size_t len, resp_ie_len; int status; int ret; - u8 *pos = &(cmd->iebuf[0]); + u8 *pos; u8 *tmp; lbs_deb_enter(LBS_DEB_CFG80211); @@ -1117,6 +1117,7 @@ static int lbs_associate(struct lbs_private *priv, ret = -ENOMEM; goto done; } + pos = &cmd->iebuf[0]; /* * cmd 50 00