[linux] 02/04: Bluetooth: Fix potential NULL dereference in RFCOMM bind callback (CVE-2015-8956)

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Oct 17 18:39:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch wheezy-security
in repository linux.

commit f214438dc467a7e242ddf5a07e0ee3346de65033
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Mon Oct 17 19:27:51 2016 +0100

    Bluetooth: Fix potential NULL dereference in RFCOMM bind callback (CVE-2015-8956)
---
 debian/changelog                                   |  2 +
 ...ix-potential-null-dereference-in-rfcomm-b.patch | 60 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 63 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index ba2780a..6435ad9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -67,6 +67,8 @@ linux (3.2.82-1) UNRELEASED; urgency=medium
   * Revert "ecryptfs: forbid opening files without mmap handler", redundant
     with upstream fixes
   * fs: Move procfs/ecryptfs stacking check into ecryptfs, to avoid ABI change
+  * Bluetooth: Fix potential NULL dereference in RFCOMM bind callback
+    (CVE-2015-8956)
 
  -- Ben Hutchings <ben at decadent.org.uk>  Sun, 04 Sep 2016 14:08:46 +0100
 
diff --git a/debian/patches/bugfix/all/bluetooth-fix-potential-null-dereference-in-rfcomm-b.patch b/debian/patches/bugfix/all/bluetooth-fix-potential-null-dereference-in-rfcomm-b.patch
new file mode 100644
index 0000000..29be422
--- /dev/null
+++ b/debian/patches/bugfix/all/bluetooth-fix-potential-null-dereference-in-rfcomm-b.patch
@@ -0,0 +1,60 @@
+From: Jaganath Kanakkassery <jaganath.k at samsung.com>
+Date: Thu, 14 May 2015 12:58:08 +0530
+Subject: Bluetooth: Fix potential NULL dereference in RFCOMM bind callback
+Origin: https://git.kernel.org/linus/951b6a0717db97ce420547222647bcc40bf1eacd
+
+addr can be NULL and it should not be dereferenced before NULL checking.
+
+Signed-off-by: Jaganath Kanakkassery <jaganath.k at samsung.com>
+Signed-off-by: Marcel Holtmann <marcel at holtmann.org>
+[bwh: Backported to 3.2:
+ - There's no 'chan' variable
+ - Keep using batostr() to log addresses
+ - Adjust context]
+---
+ net/bluetooth/rfcomm/sock.c | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+--- a/net/bluetooth/rfcomm/sock.c
++++ b/net/bluetooth/rfcomm/sock.c
+@@ -349,15 +349,19 @@ static int rfcomm_sock_create(struct net
+ 
+ static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
+ {
+-	struct sockaddr_rc *sa = (struct sockaddr_rc *) addr;
++	struct sockaddr_rc sa;
+ 	struct sock *sk = sock->sk;
+-	int err = 0;
+-
+-	BT_DBG("sk %p %s", sk, batostr(&sa->rc_bdaddr));
++	int len, err = 0;
+ 
+ 	if (!addr || addr->sa_family != AF_BLUETOOTH)
+ 		return -EINVAL;
+ 
++	memset(&sa, 0, sizeof(sa));
++	len = min_t(unsigned int, sizeof(sa), addr_len);
++	memcpy(&sa, addr, len);
++
++	BT_DBG("sk %p %s", sk, batostr(&sa.rc_bdaddr));
++
+ 	lock_sock(sk);
+ 
+ 	if (sk->sk_state != BT_OPEN) {
+@@ -372,12 +376,13 @@ static int rfcomm_sock_bind(struct socke
+ 
+ 	write_lock_bh(&rfcomm_sk_list.lock);
+ 
+-	if (sa->rc_channel && __rfcomm_get_sock_by_addr(sa->rc_channel, &sa->rc_bdaddr)) {
++	if (sa.rc_channel &&
++	    __rfcomm_get_sock_by_addr(sa.rc_channel, &sa.rc_bdaddr)) {
+ 		err = -EADDRINUSE;
+ 	} else {
+ 		/* Save source address */
+-		bacpy(&bt_sk(sk)->src, &sa->rc_bdaddr);
+-		rfcomm_pi(sk)->channel = sa->rc_channel;
++		bacpy(&bt_sk(sk)->src, &sa.rc_bdaddr);
++		rfcomm_pi(sk)->channel = sa.rc_channel;
+ 		sk->sk_state = BT_BOUND;
+ 	}
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 0197aba..f1515f5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1109,6 +1109,7 @@ bugfix/all/ecryptfs-fix-handling-of-directory-opening.patch
 bugfix/arm/arm-oabi-compat-add-missing-access-checks.patch
 bugfix/all/aacraid-check-size-values-after-double-fetch-from-us.patch
 bugfix/all/tcp-fix-use-after-free-in-tcp_xmit_retransmit_queue.patch
+bugfix/all/bluetooth-fix-potential-null-dereference-in-rfcomm-b.patch
 
 # ABI maintenance
 debian/perf-hide-abi-change-in-3.2.30.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list