From patchwork Sun Mar 24 22:39:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10867769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2F8A925 for ; Sun, 24 Mar 2019 22:39:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D409B28707 for ; Sun, 24 Mar 2019 22:39:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C15D22873B; Sun, 24 Mar 2019 22:39:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68A7128707 for ; Sun, 24 Mar 2019 22:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729016AbfCXWj3 (ORCPT ); Sun, 24 Mar 2019 18:39:29 -0400 Received: from mta-p7.oit.umn.edu ([134.84.196.207]:35680 "EHLO mta-p7.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbfCXWj3 (ORCPT ); Sun, 24 Mar 2019 18:39:29 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p7.oit.umn.edu (Postfix) with ESMTP id 610DEAE5 for ; Sun, 24 Mar 2019 22:39:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p7.oit.umn.edu ([127.0.0.1]) by localhost (mta-p7.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jNshWXX39-3M for ; Sun, 24 Mar 2019 17:39:27 -0500 (CDT) Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p7.oit.umn.edu (Postfix) with ESMTPS id 39C06A15 for ; Sun, 24 Mar 2019 17:39:27 -0500 (CDT) Received: by mail-io1-f72.google.com with SMTP id 186so6506422iox.15 for ; Sun, 24 Mar 2019 15:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=MSZ9302ITZs8dJ/k0dQkz3TFxIDi838B1mmrgn4iO+c=; b=Hw+JKlHlphuYIfhA86OcYH7QJJNT+yEV1dpMGblJ4W4+6rm06OZN+43p/LZrTuU7Sv RC+YRDIj2YBKND1q1qj8GoxA/eupsikspXfEKy5w+IE9Qi5lAFzFwnu7WrgiFEkxvRXv Sml7SBVb1O05kbBSo9WX3dh8URHbfIqOkQRipIKjJpoDgl1qJPtlAae12PW6LKbVRkKk mTZFNE+99qwpIlZf/tZtTUu+VRT0L+M2ahyqTwgFYR0aY94bdhq89wdrjwdeMKSXwegx rziBKLFM/D7KK/yxk0MkdfGxaiuzdikVa438yPkqeHDzt2d8vD4cRa861OHUL9LA2XaW dytw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MSZ9302ITZs8dJ/k0dQkz3TFxIDi838B1mmrgn4iO+c=; b=Sv6sMblvR/SWXO49kQ7AEelqYFCBz+B3DQjtrICyhnHZdmy28vr/FGDS54FYHLF4R/ GA0qgZLGrLtaElmnvQivwg5qanbc7w9fEgnh0ccG4p9l1urx1fpY2Yq8Z6kqZvoYRncH DY2AC0x8zpNKMLt/NAeInbd3WBvfIs3LPXHDT9BzyYHK8fDTzT3NfHHmpw4eSvS273cc 9OHMMq8nF5ZPOEgF2jVp9+i20kMRpbqE+fdMGDN6EFXsEpIBD2wJcWhdv+dLSUAhYHEP WXvAUCJbr02ogYY67cbn41Yl834RmRN9SkH1Rudc39z2UOkNJZTcftOzznD18rKAm7i5 ULkA== X-Gm-Message-State: APjAAAWfsnoVOmH7dexiVN4uRkGkzynY+iVY3mSQb4GrJ9fg8zoMfiRu HqqI3Djv6KzKDthBLr+bdM4ossD4z0zjoc1TU0w1yrqYmphDqIqhbRj36KCKvIcAVnabOFCDAtv 2TSdkJljYmRg87I3z2SJ7gOqh X-Received: by 2002:a5e:d608:: with SMTP id w8mr14493733iom.293.1553467166847; Sun, 24 Mar 2019 15:39:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6qD9mf251+TcHDyhf9i4142WlTt8nVZvse0W3jyS5GuseyoKNZZYuMQUrpICnyfxniXvznA== X-Received: by 2002:a5e:d608:: with SMTP id w8mr14493721iom.293.1553467166653; Sun, 24 Mar 2019 15:39:26 -0700 (PDT) Received: from bee.dtc.umn.edu (cs-bee-u.cs.umn.edu. [128.101.106.63]) by smtp.gmail.com with ESMTPSA id f17sm4477400itb.36.2019.03.24.15.39.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 15:39:25 -0700 (PDT) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Alan Stern , Greg Kroah-Hartman , linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, linux-kernel@vger.kernel.org Subject: [PATCH] usb: sierra: fix a missing check of device_create_file Date: Sun, 24 Mar 2019 17:39:20 -0500 Message-Id: <20190324223920.961-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP device_create_file() could fail and return an error code. The fix captures the error and returns the error code upstream in case it indeed failed. Signed-off-by: Kangjie Lu --- drivers/usb/storage/sierra_ms.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c index 6ac60abd2e15..2c049e3a56eb 100644 --- a/drivers/usb/storage/sierra_ms.c +++ b/drivers/usb/storage/sierra_ms.c @@ -195,6 +195,10 @@ int sierra_ms_init(struct us_data *us) } complete: result = device_create_file(&us->pusb_intf->dev, &dev_attr_truinst); + if (result) { + kfree(swocInfo); + return result; + } return 0; }