From: NeilBrown <neilb@suse.de>
To: Olivier Sobrie <olivier@sobrie.be>,
"David S. Miller" <davem@davemloft.net>,
Jan Dumon <j.dumon@option.com>
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
GTA04 owners <gta04-owner@goldelico.com>
Subject: [PATCH] hso: fix refcnt leak in recent patch.
Date: Tue, 14 Apr 2015 09:36:34 +1000 [thread overview]
Message-ID: <20150414093634.4fe24ba3@notabene.brown> (raw)
[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]
Prior to
commit 29bd3bc1194c624ce863cab2a7da9bc1f0c3b47b
hso: fix crash when device disappears while serial port is open
hso_serial_open would always kref_get(&serial->parent->ref) before
returning zero.
Since that commit, it only calls kref_get when returning 0 if
serial->port.count was zero.
This results in calls to
kref_put(&serial->parent->ref, hso_serial_ref_free);
after hso_serial_ref_free has been called, which dereferences a freed
pointer.
This patch adds the missing kref_get().
Fixes: commit 29bd3bc1194c624ce863cab2a7da9bc1f0c3b47b
Cc: stable@vger.kernel.org (v4.0)
Cc: Olivier Sobrie <olivier@sobrie.be>
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 75befc1bd816..6848fc903340 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1299,6 +1299,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
}
} else {
D1("Port was already open");
+ kref_get(&serial->parent->ref);
}
usb_autopm_put_interface(serial->parent->interface);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
next reply other threads:[~2015-04-13 23:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 23:36 NeilBrown [this message]
2015-04-14 1:03 ` [PATCH] hso: fix refcnt leak in recent patch NeilBrown
2015-04-14 1:03 ` NeilBrown
2015-04-14 6:50 ` Olivier Sobrie
2015-04-14 6:50 ` Olivier Sobrie
2015-04-14 7:35 ` NeilBrown
2015-04-16 13:21 ` Olivier Sobrie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150414093634.4fe24ba3@notabene.brown \
--to=neilb@suse.de \
--cc=davem@davemloft.net \
--cc=gta04-owner@goldelico.com \
--cc=j.dumon@option.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olivier@sobrie.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.