From patchwork Fri Sep 4 10:04:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7121211 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 E9557BEEC1 for ; Fri, 4 Sep 2015 10:04:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E2272054C for ; Fri, 4 Sep 2015 10:04:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F45B2052C for ; Fri, 4 Sep 2015 10:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754960AbbIDKE2 (ORCPT ); Fri, 4 Sep 2015 06:04:28 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:35754 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751386AbbIDKE1 (ORCPT ); Fri, 4 Sep 2015 06:04:27 -0400 Received: by pacfv12 with SMTP id fv12so20528980pac.2; Fri, 04 Sep 2015 03:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=uf19wwJQBr9YwXjbI9vw52P8Q+kByHjLkGh4uaFM6P4=; b=AIH9SIbxBT4Vo7ufJmRs+buodwGPHhaMd/NA2VruL2fsVBUsF9Ai0Rf2QZZQ6n9eCQ Wf6urS0tv+O0nrheNmN9yeMtMXrdE8DZgKjO5thEXxkyMQPHST2htAyHWixad6/SLvLw imou9f4WM8megTZye4b9NIkJ/cPuBPbbM0X0IN2KX0KgkXe/BnaYQpldlg54zAYE6HN2 QOh71g6JECsR2IWnHJGdrYwBi4fISSG7E+wP19YJvIyNlakf2fVoDOD+oBMEh3o2Z/8c GzBQ5NurLouo+wkxNr/dmw69ofFtakP9ZbJMB8AkQXqYMJDqO2uSb/f9m+OG2g+hZ7XL bN3A== X-Received: by 10.68.249.36 with SMTP id yr4mr6637280pbc.18.1441361066540; Fri, 04 Sep 2015 03:04:26 -0700 (PDT) Received: from localhost.localdomain ([122.175.59.239]) by smtp.gmail.com with ESMTPSA id gw3sm1912383pbc.46.2015.09.04.03.04.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Sep 2015 03:04:25 -0700 (PDT) From: Sudip Mukherjee To: Johnny Kim , Rachel Kim , Dean Lee , Chris Park , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, Sudip Mukherjee Subject: [PATCH] staging: wilc1000: fix freeing of ERR_PTR Date: Fri, 4 Sep 2015 15:34:15 +0530 Message-Id: <1441361055-30957-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=-6.8 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 If memdup_user() fails then it will return the error code in ERR_PTR. We were checking it with IS_ERR but then again trying to free it on the error path. Signed-off-by: Sudip Mukherjee --- drivers/staging/wilc1000/linux_wlan.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index c90c459..020ed03 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2116,10 +2116,8 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (size && wrq->u.data.pointer) { buff = memdup_user(wrq->u.data.pointer, wrq->u.data.length); - if (IS_ERR(buff)) { - s32Error = PTR_ERR(buff); - goto done; - } + if (IS_ERR(buff)) + return PTR_ERR(buff); if (strncasecmp(buff, "RSSI", length) == 0) {