Эх сурвалжийг харах

Bluetooth: Fix missing NULL check for smp_chan_create() return value

The smp_chan_create function may return NULL, e.g. in the case of memory
allocation failure, so we always need to check for this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Johan Hedberg 11 жил өмнө
parent
commit
c29d244417
1 өөрчлөгдсөн 2 нэмэгдсэн , 0 устгасан
  1. 2 0
      net/bluetooth/smp.c

+ 2 - 0
net/bluetooth/smp.c

@@ -888,6 +888,8 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
 		return 0;
 
 	smp = smp_chan_create(conn);
+	if (!smp)
+		return SMP_UNSPECIFIED;
 
 	skb_pull(skb, sizeof(*rp));