From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754159AbbICGAl (ORCPT ); Thu, 3 Sep 2015 02:00:41 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:33415 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752040AbbICGAj (ORCPT ); Thu, 3 Sep 2015 02:00:39 -0400 From: Sudip Mukherjee To: "David S. Miller" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] net: wan: sbni: fix device usage count Date: Thu, 3 Sep 2015 11:30:30 +0530 Message-Id: <1441260030-8141-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dev_get_by_name() will increment the usage count if the matching device is found. But we were not decrementing the count if we have got the device and the device is non-active. Signed-off-by: Sudip Mukherjee --- drivers/net/wan/sbni.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 758c4ba..8fef8d8 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -1358,6 +1358,8 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd ) if( !slave_dev || !(slave_dev->flags & IFF_UP) ) { netdev_err(dev, "trying to enslave non-active device %s\n", slave_name); + if (slave_dev) + dev_put(slave_dev); return -EPERM; } -- 1.9.1