lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1507081049-16838-1-git-send-email-baijiaju1990@163.com>
Date:   Wed,  4 Oct 2017 09:37:29 +0800
From:   Jia-Ju Bai <baijiaju1990@....com>
To:     philipp.reisner@...bit.com, lars.ellenberg@...bit.com
Cc:     drbd-dev@...ts.linbit.com, linux-kernel@...r.kernel.org,
        Jia-Ju Bai <baijiaju1990@....com>
Subject: [PATCH] block/drbd: Fix a sleep-in-atomic bug in notify_helper

The driver may sleep under a RCU lock, and the function call path is:
drbd_sync_handshake (acquire the RCU lock)
  drbd_asb_recover_1p
    drbd_khelper
      notify_helper
        genlmsg_new(GFP_NOIO) --> may sleep

To fix it, GFP_NOIO is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@....com>
---
 drivers/block/drbd/drbd_nl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index a12f77e..ad093da 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -4790,7 +4790,7 @@ void notify_helper(enum drbd_notification_type type,
 	helper_info.helper_name_len = min(strlen(name), sizeof(helper_info.helper_name));
 	helper_info.helper_status = status;
 
-	skb = genlmsg_new(NLMSG_GOODSIZE, GFP_NOIO);
+	skb = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
 	err = -ENOMEM;
 	if (!skb)
 		goto fail;
-- 
1.7.9.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ